|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*.*.*' |
| 7 | + repository_dispatch: |
| 8 | + types: [release] |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-android: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + environment: release-build |
| 15 | + container: |
| 16 | + image: cimg/android:2026.03.1-node |
| 17 | + options: -u root |
| 18 | + env: |
| 19 | + KEYSTORE_PATH: ${{ github.workspace }}/insporation.jks |
| 20 | + steps: |
| 21 | + - name: "Install SDK 36 build tools" |
| 22 | + run: sdkmanager "build-tools;36.0.0" |
| 23 | + - uses: actions/checkout@v6 |
| 24 | + - uses: subosito/flutter-action@v2 |
| 25 | + id: flutter-action |
| 26 | + with: |
| 27 | + flutter-version: '3.41.x' |
| 28 | + channel: stable |
| 29 | + - name: Workaround flutter directory permissions |
| 30 | + run: |- |
| 31 | + git config --global --add safe.directory ${{ steps.flutter-action.outputs.CACHE-PATH }} |
| 32 | + git config --global --add safe.directory ${{ steps.flutter-action.outputs.CACHE-PATH }}/flutter |
| 33 | + git config --global --add safe.directory $(pwd) |
| 34 | + - name: Setup keystore |
| 35 | + run: | |
| 36 | + echo "$KEYSTORE" | base64 -d > "$KEYSTORE_PATH" |
| 37 | + env: |
| 38 | + KEYSTORE: ${{ secrets.KEYSTORE }} |
| 39 | + - name: Build |
| 40 | + run: | |
| 41 | + flutter build apk --release --build-number=$GITHUB_RUN_NUMBER |
| 42 | + flutter build appbundle --release --build-number=$GITHUB_RUN_NUMBER |
| 43 | + mkdir -p dist |
| 44 | + cp build/app/outputs/apk/release/app-release.apk dist/insporation-nightly-$(git describe --tags 2>/dev/null || echo $GITHUB_RUN_NUMBER).apk |
| 45 | + cp build/app/outputs/bundle/release/app-release.aab dist/insporation-nightly-$(git describe --tags 2>/dev/null || echo $GITHUB_RUN_NUMBER).aab |
| 46 | + git rev-parse main > dist/BUILD_SHA |
| 47 | + env: |
| 48 | + KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} |
| 49 | + KEYSTORE_KEY_ALIAS: key |
| 50 | + - uses: actions/upload-artifact@v7 |
| 51 | + with: |
| 52 | + name: Android Application bundles |
| 53 | + path: dist |
| 54 | + publish-android-fdroid: |
| 55 | + needs: build-android |
| 56 | + runs-on: ubuntu-latest |
| 57 | + environment: release-build |
| 58 | + container: |
| 59 | + image: registry.gitlab.com/fdroid/docker-executable-fdroidserver:master |
| 60 | + env: |
| 61 | + KEYSTORE_PATH: ${{ github.workspace }}/insporation.jks |
| 62 | + LC_ALL: en_US.UTF-8 |
| 63 | + LANG: en_US.UTF-8 |
| 64 | + steps: |
| 65 | + - uses: actions/download-artifact@v8 |
| 66 | + with: |
| 67 | + name: Android Application bundles |
| 68 | + path: dist |
| 69 | + - uses: AButler/upload-release-assets@v2.0 |
| 70 | + with: |
| 71 | + files: 'dist/*' |
| 72 | + release-tag: ${{ github.ref_name }} |
| 73 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 74 | + - name: Checkout F-Droid repository |
| 75 | + uses: actions/checkout@v6 |
| 76 | + with: |
| 77 | + ref: gh-pages |
| 78 | + path: pages |
| 79 | + - name: Setup keystore |
| 80 | + run: | |
| 81 | + echo "$KEYSTORE" | base64 -d > "$KEYSTORE_PATH" |
| 82 | + env: |
| 83 | + KEYSTORE: ${{ secrets.KEYSTORE }} |
| 84 | + - name: Update F-Droid repository |
| 85 | + run: | |
| 86 | + . /etc/profile.d/bsenv.sh |
| 87 | +
|
| 88 | + cd pages |
| 89 | +
|
| 90 | + git config --local user.email "me+nightly-ci@jhass.eu" |
| 91 | + git config --local user.name "Github Actions Nightly Job" |
| 92 | +
|
| 93 | + # Truncate history |
| 94 | + git checkout --orphan new-pages |
| 95 | + git commit -m "Import previous state" |
| 96 | +
|
| 97 | + cd fdroid |
| 98 | +
|
| 99 | + # Add new build |
| 100 | + cp ../../dist/*.apk repo/ |
| 101 | +
|
| 102 | + # Cleanup archive |
| 103 | + find archive -name '*.apk' | sort -V | head -n-2 | xargs -r rm |
| 104 | +
|
| 105 | + # Rebuild repos |
| 106 | + ${fdroidserver}/fdroid update |
| 107 | +
|
| 108 | + # Cleanup icons |
| 109 | + for icon in {repo,archive}/icons/*.*.png; do |
| 110 | + repo="$(dirname "$(dirname "$icon")")" |
| 111 | + base="$(basename "$icon" .png)" |
| 112 | + build="$(echo "$base" | tr -Cd '0-9')" |
| 113 | + if [ ! -e "$repo/insporation-nightly-$build.apk" ]; then |
| 114 | + rm $repo/icons*/$base.{png,xml} || echo "No icons for $repo/$base.apk present" |
| 115 | + fi |
| 116 | + done |
| 117 | +
|
| 118 | + # Publish |
| 119 | + git add . |
| 120 | + git commit -m "Update fdroid repository for build $GITHUB_RUN_NUMBER" |
| 121 | + git push -f "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" new-pages:gh-pages |
| 122 | + shell: bash |
| 123 | + env: |
| 124 | + KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} |
| 125 | + KEYSTORE_KEY_ALIAS: key |
| 126 | + - name: Trigger Github Pages deploy |
| 127 | + uses: benc-uk/workflow-dispatch@v1.2.2 |
| 128 | + with: |
| 129 | + workflow: pages.yml |
| 130 | + ref: gh-pages |
| 131 | + publish-android-playstore: |
| 132 | + needs: build-android |
| 133 | + runs-on: ubuntu-latest |
| 134 | + environment: release-build |
| 135 | + env: |
| 136 | + KEYSTORE_PATH: ${{ github.workspace }}/insporation.jks |
| 137 | + LC_ALL: en_US.UTF-8 |
| 138 | + LANG: en_US.UTF-8 |
| 139 | + steps: |
| 140 | + - uses: actions/checkout@v6 |
| 141 | + - uses: actions/download-artifact@v8 |
| 142 | + with: |
| 143 | + name: Android Application bundles |
| 144 | + - uses: 'google-github-actions/auth@v3' |
| 145 | + with: |
| 146 | + service_account: "fastlane@insporation.iam.gserviceaccount.com" |
| 147 | + workload_identity_provider: "projects/111601323342/locations/global/workloadIdentityPools/insporation-github-actions/providers/github" |
| 148 | + - name: Publish to Play Store |
| 149 | + run: | |
| 150 | + cd android |
| 151 | + bundle config set deployment 'true' |
| 152 | + bundle |
| 153 | + bundle exec fastlane supply --aab ../dist/*.aab --track internal |
| 154 | + publish-ios: |
| 155 | + runs-on: macos-latest |
| 156 | + environment: release-build |
| 157 | + steps: |
| 158 | + - uses: actions/checkout@v6 |
| 159 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 160 | + with: |
| 161 | + xcode-version: latest-stable |
| 162 | + - name: Install iOS SDK |
| 163 | + run: | |
| 164 | + xcrun simctl list > /dev/null # https://github.com/actions/runner-images/issues/13459 |
| 165 | + xcodebuild -downloadPlatform iOS |
| 166 | + - uses: subosito/flutter-action@v2 |
| 167 | + with: |
| 168 | + flutter-version: '3.41.x' |
| 169 | + channel: stable |
| 170 | + - name: Build |
| 171 | + run: | |
| 172 | + flutter build ios --release --no-codesign --build-number=$GITHUB_RUN_NUMBER |
| 173 | + cd ios |
| 174 | + bundle config set deployment 'true' |
| 175 | + bundle |
| 176 | + bundle exec fastlane beta |
| 177 | + env: |
| 178 | + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} |
| 179 | + MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }} |
| 180 | + APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} |
0 commit comments