chore: Attach build outputs as release artifacts when a GH release is… #242
This file contains hidden or 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
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| pull_request: | |
| branches: [ main ] | |
| name: Build | |
| jobs: | |
| check_dependencies: | |
| name: Validate dependencies | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - id: get_flutter_version | |
| run: | | |
| full_version=`grep flutter .tool-versions | awk '{print $2}'` | |
| version=`echo $full_version | awk -F '-' '{print $1}'` | |
| channel=`echo $full_version | awk -F '-' '{print $2}'` | |
| echo "version=${version}" >> $GITHUB_OUTPUT | |
| echo "channel=${channel}" >> $GITHUB_OUTPUT | |
| - uses: subosito/[email protected] | |
| with: | |
| flutter-version: ${{ steps.get_flutter_version.outputs.version }} | |
| channel: ${{ steps.get_flutter_version.outputs.channel }} | |
| cache: true | |
| cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache | |
| cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' # optional, change this to specify the cache path | |
| architecture: x64 # optional, x64 or arm64 | |
| - run: | | |
| flutter doctor --verbose || true | |
| - run: flutter pub get | |
| - name: Check dependencies | |
| run: flutter pub run dependency_validator | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - id: get_flutter_version | |
| run: | | |
| full_version=`grep flutter .tool-versions | awk '{print $2}'` | |
| version=`echo $full_version | awk -F '-' '{print $1}'` | |
| channel=`echo $full_version | awk -F '-' '{print $2}'` | |
| echo "version=${version}" >> $GITHUB_OUTPUT | |
| echo "channel=${channel}" >> $GITHUB_OUTPUT | |
| - uses: subosito/[email protected] | |
| with: | |
| flutter-version: ${{ steps.get_flutter_version.outputs.version }} | |
| channel: ${{ steps.get_flutter_version.outputs.channel }} | |
| cache: true | |
| cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache | |
| cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' # optional, change this to specify the cache path | |
| - run: | | |
| flutter doctor --verbose || true | |
| - run: flutter pub get | |
| - name: Run Flutter tests | |
| run: flutter test | |
| build_android: | |
| name: Build Android | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| #- uses: gradle/actions/setup-gradle@v4 | |
| # with: | |
| # # Only write to the cache for builds on the 'main' branch. | |
| # # Builds on other branches will only read existing entries from the cache. | |
| # cache-read-only: ${{ github.ref != 'refs/heads/main' }} | |
| # gradle-version: '7.6' # same version as in android/gradle/wrapper/gradle-wrapper.properties | |
| # #gradle-version: wrapper | |
| # #build-root-directory: android | |
| - id: get_flutter_version | |
| run: | | |
| full_version=`grep flutter .tool-versions | awk '{print $2}'` | |
| version=`echo $full_version | awk -F '-' '{print $1}'` | |
| channel=`echo $full_version | awk -F '-' '{print $2}'` | |
| echo "version=${version}" >> $GITHUB_OUTPUT | |
| echo "channel=${channel}" >> $GITHUB_OUTPUT | |
| - uses: subosito/[email protected] | |
| with: | |
| flutter-version: ${{ steps.get_flutter_version.outputs.version }} | |
| channel: ${{ steps.get_flutter_version.outputs.channel }} | |
| cache: true | |
| cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache | |
| cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' # optional, change this to specify the cache path | |
| - run: java -version | |
| - run: | | |
| flutter doctor --verbose || true | |
| - run: | | |
| flutter analyze --suggestions | |
| - run: flutter pub get | |
| - name: Build APK | |
| run: flutter build apk --debug | |
| # - name: Archive artifacts | |
| # uses: actions/upload-artifact@v2 | |
| # with: | |
| # name: essentiel_flutter_artifacts | |
| # path: | | |
| # build/app/outputs/flutter-apk/app.apk | |
| # build/**/outputs/**/*.aab | |
| # build/**/outputs/**/mapping.txt | |
| # flutter_drive.log | |
| build_ios: | |
| name: Build IOS | |
| runs-on: macos-latest | |
| if: false | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - id: get_flutter_version | |
| run: | | |
| full_version=`grep flutter .tool-versions | awk '{print $2}'` | |
| version=`echo $full_version | awk -F '-' '{print $1}'` | |
| channel=`echo $full_version | awk -F '-' '{print $2}'` | |
| echo "version=${version}" >> $GITHUB_OUTPUT | |
| echo "channel=${channel}" >> $GITHUB_OUTPUT | |
| - uses: subosito/[email protected] | |
| with: | |
| flutter-version: ${{ steps.get_flutter_version.outputs.version }} | |
| channel: ${{ steps.get_flutter_version.outputs.channel }} | |
| cache: true | |
| cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache | |
| cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' # optional, change this to specify the cache path | |
| architecture: x64 # optional, x64 or arm64 | |
| - run: | | |
| flutter doctor --verbose || true | |
| - run: | | |
| flutter analyze --suggestions | |
| - run: flutter pub get | |
| - name: Build IOS | |
| run: flutter build ios --release --no-codesign |