ci: add playstore release #15
Workflow file for this run
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
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| changelog: | |
| name: Generate changelog | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| # `persist-credentials` is required to push new commits to the repository. | |
| persist-credentials: true | |
| - name: Generate changelog | |
| uses: orhun/git-cliff-action@v4 | |
| with: | |
| config: cliff.toml | |
| args: --latest --strip header --output release-body.md | |
| - name: Upload release body artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: release-body | |
| path: release-body.md | |
| - name: Update CHANGELOG.md | |
| uses: orhun/git-cliff-action@v4 | |
| with: | |
| config: cliff.toml | |
| args: --output CHANGELOG.md | |
| - name: Bump version in pubspec.yaml | |
| run: | | |
| set -e | |
| VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//') | |
| if [ -z "$VERSION" ]; then | |
| echo "ERROR: could not derive version from tag '${{ github.ref_name }}'" >&2 | |
| exit 1 | |
| fi | |
| sed -i "s/^version: .*/version: ${VERSION}+${{ github.run_number }}/" pubspec.yaml | |
| - name: Commit CHANGELOG.md and pubspec.yaml | |
| uses: stefanzweifel/git-auto-commit-action@v7 | |
| with: | |
| commit_message: "chore(release): bump version to ${{ github.ref_name }}" | |
| file_pattern: CHANGELOG.md pubspec.yaml | |
| build-android: | |
| name: Build Android | |
| needs: [changelog] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| - name: Set up Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| - name: Set up Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.41.7' | |
| cache: true | |
| - name: Install Fastforge | |
| run: dart pub global activate fastforge | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Generate code | |
| run: dart run build_runner build --delete-conflicting-outputs | |
| - name: Decode release keystore | |
| run: | | |
| echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > "${{ runner.temp }}/release.jks" | |
| - name: Package APK | |
| env: | |
| KEYSTORE_PATH: ${{ runner.temp }}/release.jks | |
| ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }} | |
| ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | |
| ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
| run: fastforge package --platform android --targets apk | |
| - name: Package AAB | |
| env: | |
| KEYSTORE_PATH: ${{ runner.temp }}/release.jks | |
| ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }} | |
| ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | |
| ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
| run: fastforge package --platform android --targets aab | |
| - name: Upload Android APK artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: classi-android-apk | |
| path: dist/**/*.apk | |
| - name: Upload Android AAB artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: classi-android-aab | |
| path: dist/**/*.aab | |
| build-linux: | |
| name: Build Linux | |
| needs: [changelog] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| - name: Install Linux build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev libsecret-1-dev libssl-dev locate | |
| - name: Install appimagetool | |
| run: | | |
| wget -q -O appimagetool "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" | |
| chmod +x appimagetool | |
| sudo mv appimagetool /usr/local/bin/ | |
| - name: Set up Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.41.7' | |
| cache: true | |
| - name: Install Fastforge | |
| run: dart pub global activate fastforge | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Generate code | |
| run: dart run build_runner build --delete-conflicting-outputs | |
| - name: Package AppImage | |
| run: fastforge package --platform linux --targets appimage | |
| - name: Upload Linux artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: classi-linux-appimage | |
| path: dist/**/*.AppImage | |
| build-macos: | |
| name: Build macOS | |
| needs: [changelog] | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| - name: Install appdmg | |
| run: npm install -g appdmg | |
| - name: Set up Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.41.7' | |
| cache: true | |
| - name: Install Fastforge | |
| run: dart pub global activate fastforge | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Generate code | |
| run: dart run build_runner build --delete-conflicting-outputs | |
| - name: Package DMG | |
| run: fastforge package --platform macos --targets dmg | |
| - name: Upload macOS artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: classi-macos-dmg | |
| path: dist/**/*.dmg | |
| build-windows: | |
| name: Build Windows | |
| needs: [changelog] | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| - name: Install Inno Setup | |
| run: choco install innosetup --no-progress -y | |
| - name: Set up Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.41.7' | |
| cache: true | |
| - name: Install Fastforge | |
| run: dart pub global activate fastforge | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Generate code | |
| run: dart run build_runner build --delete-conflicting-outputs | |
| - name: Package EXE | |
| run: fastforge package --platform windows --targets exe | |
| - name: Upload Windows artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: classi-windows-exe | |
| path: dist/**/*.exe | |
| publish-playstore: | |
| name: Publish to Play Store | |
| needs: [build-android] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download Android AAB artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: classi-android-aab | |
| path: artifacts/aab | |
| - name: Decode Play Store credentials | |
| run: | | |
| echo "${{ secrets.PLAYSTORE_CREDENTIALS_BASE64 }}" | base64 --decode > "${{ runner.temp }}/playstore-credentials.json" | |
| - name: Set up Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| - name: Set up Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.41.7' | |
| cache: true | |
| - name: Install Fastforge | |
| run: dart pub global activate fastforge | |
| - name: Publish to Play Store | |
| env: | |
| PLAYSTORE_CREDENTIALS: ${{ runner.temp }}/playstore-credentials.json | |
| run: | | |
| AAB_PATH=$(find artifacts/aab -name "*.aab" | head -1) | |
| fastforge publish \ | |
| --path "$AAB_PATH" \ | |
| --targets playstore \ | |
| --playstore-package-name org.openpatch.classi \ | |
| --playstore-track production | |
| release: | |
| name: Create GitHub Release | |
| needs: [changelog, build-android, build-linux, build-macos, build-windows, publish-playstore] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| body_path: artifacts/release-body/release-body.md | |
| files: | | |
| artifacts/classi-android-apk/**/*.apk | |
| artifacts/classi-linux-appimage/**/*.AppImage | |
| artifacts/classi-macos-dmg/**/*.dmg | |
| artifacts/classi-windows-exe/**/*.exe |