|
| 1 | +name: Release SDK |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - development |
| 7 | + paths: |
| 8 | + - VERSION |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: write |
| 16 | + id-token: write |
| 17 | + |
| 18 | +jobs: |
| 19 | + test: |
| 20 | + name: Test |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + - name: Setup Flutter SDK |
| 25 | + uses: subosito/flutter-action@v2 |
| 26 | + with: |
| 27 | + flutter-version: ${{ vars.FLUTTER_VERSION }} |
| 28 | + channel: stable |
| 29 | + cache: true |
| 30 | + - name: Install dependencies |
| 31 | + run: flutter pub get |
| 32 | + - name: Run tests |
| 33 | + run: flutter test |
| 34 | + |
| 35 | + build-android: |
| 36 | + name: Build Android |
| 37 | + needs: test |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + - uses: actions/setup-java@v4 |
| 42 | + with: |
| 43 | + distribution: temurin |
| 44 | + java-version: "17" |
| 45 | + cache: gradle |
| 46 | + - name: Setup Flutter SDK |
| 47 | + uses: subosito/flutter-action@v2 |
| 48 | + with: |
| 49 | + flutter-version: ${{ vars.FLUTTER_VERSION }} |
| 50 | + channel: stable |
| 51 | + cache: true |
| 52 | + - name: Install example dependencies |
| 53 | + working-directory: example |
| 54 | + run: flutter pub get |
| 55 | + - name: Build example APK |
| 56 | + working-directory: example |
| 57 | + run: flutter build apk |
| 58 | + |
| 59 | + build-ios: |
| 60 | + name: Build iOS |
| 61 | + needs: test |
| 62 | + runs-on: macos-15 |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v4 |
| 65 | + - name: Set up Xcode |
| 66 | + uses: maxim-lobanov/setup-xcode@v1 |
| 67 | + with: |
| 68 | + xcode-version: latest-stable |
| 69 | + - name: Setup Flutter SDK |
| 70 | + uses: subosito/flutter-action@v2 |
| 71 | + with: |
| 72 | + flutter-version: ${{ vars.FLUTTER_VERSION }} |
| 73 | + channel: stable |
| 74 | + cache: true |
| 75 | + - name: Install example dependencies |
| 76 | + working-directory: example |
| 77 | + run: flutter pub get |
| 78 | + - name: Build unsigned Xcode archive |
| 79 | + working-directory: example |
| 80 | + run: flutter build ipa --no-codesign |
| 81 | + |
| 82 | + setup-and-version: |
| 83 | + needs: [build-android, build-ios] |
| 84 | + runs-on: ubuntu-latest |
| 85 | + outputs: |
| 86 | + final_version: ${{ steps.version-file.outputs.release-version }} |
| 87 | + steps: |
| 88 | + - name: Checkout repository |
| 89 | + uses: actions/checkout@v4 |
| 90 | + - name: Get current version |
| 91 | + id: version-file |
| 92 | + run: | |
| 93 | + version_from_file=$(head -n 1 VERSION) |
| 94 | + echo "release-version=$version_from_file" >> $GITHUB_OUTPUT |
| 95 | +
|
| 96 | + release-and-tag: |
| 97 | + needs: [setup-and-version] |
| 98 | + runs-on: ubuntu-latest |
| 99 | + steps: |
| 100 | + - name: Checkout repository |
| 101 | + uses: actions/checkout@v4 |
| 102 | + |
| 103 | + - name: Setup Flutter |
| 104 | + uses: subosito/flutter-action@v2 |
| 105 | + with: |
| 106 | + flutter-version: ${{ vars.FLUTTER_VERSION }} |
| 107 | + channel: stable |
| 108 | + cache: true |
| 109 | + |
| 110 | + - name: Create git tag |
| 111 | + run: | |
| 112 | + git tag "v${{ needs.setup-and-version.outputs.final_version }}" |
| 113 | + git push origin "v${{ needs.setup-and-version.outputs.final_version }}" |
| 114 | +
|
| 115 | + - name: Publish Package |
| 116 | + run: | |
| 117 | + flutter pub publish --force |
| 118 | +
|
| 119 | + - uses: ffurrer2/extract-release-notes@v2 |
| 120 | + id: extract-release-notes |
| 121 | + with: |
| 122 | + changelog_file: CHANGELOG.md |
| 123 | + release_notes_file: ${{ needs.setup-and-version.outputs.final_version }}.md |
| 124 | + |
| 125 | + - name: Create Github release |
| 126 | + uses: ncipollo/release-action@v1 |
| 127 | + with: |
| 128 | + makeLatest: true |
| 129 | + tag: v${{ needs.setup-and-version.outputs.final_version }} |
| 130 | + body: | |
| 131 | + ## Release notes: |
| 132 | + ${{ steps.extract-release-notes.outputs.release_notes }} |
0 commit comments