fix: workflow #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Flutter Publish Branch | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name 'David Macan' | |
git config user.email '[email protected]' | |
git config pull.rebase false # merge | |
- name: Mirror to main-pub branch | |
run: | | |
git fetch | |
git checkout -b main-pub || git checkout main-pub | |
git merge main | |
git pull origin main-pub || echo "No remote branch main-pub" | |
- name: Update .gitignore | |
run: | | |
sed -i '/\*.g.dart/d' .gitignore | |
sed -i '/\*.gen.dart/d' .gitignore | |
sed -i '/\*.freezed.dart/d' .gitignore | |
sed -i '/\*.gr.dart/d' .gitignore | |
sed -i '/\/lib\/generated/d' .gitignore | |
git add .gitignore | |
git diff --staged --exit-code || git commit -m "Update .gitignore for main-pub branch" | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.13.8' # Specify your Flutter version | |
- name: Run build_runner | |
run: | | |
flutter pub get | |
flutter pub run build_runner build --delete-conflicting-outputs | |
git add . | |
git diff --staged --exit-code || git commit -m "Generate files with build_runner" | |
- name: Push changes | |
run: | | |
git push origin main-pub |