ci(release): automate GitHub release publication #1
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*" | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| cache: true | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Build Linux | |
| run: flutter build linux --release | |
| - name: Package Linux artifact | |
| run: tar -czf codewalk-linux-x64.tar.gz -C build/linux/x64/release/bundle . | |
| - name: Upload Linux artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codewalk-linux | |
| path: codewalk-linux-x64.tar.gz | |
| build-windows: | |
| runs-on: windows-latest | |
| timeout-minutes: 35 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| cache: true | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Build Windows | |
| run: flutter build windows --release | |
| - name: Package Windows artifact | |
| shell: pwsh | |
| run: Compress-Archive -Path "build/windows/x64/runner/Release/*" -DestinationPath "codewalk-windows-x64.zip" | |
| - name: Upload Windows artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codewalk-windows | |
| path: codewalk-windows-x64.zip | |
| build-macos: | |
| runs-on: macos-latest | |
| timeout-minutes: 35 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| cache: true | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Build macOS (universal) | |
| run: flutter build macos --release --universal | |
| - name: Package macOS artifacts | |
| run: | | |
| tar -czf codewalk-macos-arm64.tar.gz -C build/macos/Build/Products/Release codewalk.app | |
| cp codewalk-macos-arm64.tar.gz codewalk-macos-x64.tar.gz | |
| - name: Upload macOS artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codewalk-macos | |
| path: | | |
| codewalk-macos-arm64.tar.gz | |
| codewalk-macos-x64.tar.gz | |
| build-android: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 35 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| cache: true | |
| - name: Setup Android signing | |
| env: | |
| KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | |
| STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }} | |
| KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | |
| run: | | |
| if [ -n "$KEYSTORE_BASE64" ]; then | |
| echo "$KEYSTORE_BASE64" | base64 --decode > android/app/upload-keystore.jks | |
| { | |
| echo "storePassword=$STORE_PASSWORD" | |
| echo "keyPassword=$KEY_PASSWORD" | |
| echo "keyAlias=$KEY_ALIAS" | |
| echo "storeFile=upload-keystore.jks" | |
| } > android/key.properties | |
| else | |
| echo "Signing secrets not configured. Building unsigned artifact." | |
| fi | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Build APK (arm64) | |
| run: flutter build apk --release --target-platform android-arm64 | |
| - name: Rename APK | |
| run: mv build/app/outputs/flutter-apk/app-release.apk codewalk-android-arm64.apk | |
| - name: Upload Android artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codewalk-android | |
| path: codewalk-android-arm64.apk | |
| create-release: | |
| runs-on: ubuntu-latest | |
| needs: [build-linux, build-windows, build-macos, build-android] | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| - name: List artifacts | |
| run: find artifacts/ -type f | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| artifacts/codewalk-linux/codewalk-linux-x64.tar.gz | |
| artifacts/codewalk-windows/codewalk-windows-x64.zip | |
| artifacts/codewalk-macos/codewalk-macos-arm64.tar.gz | |
| artifacts/codewalk-macos/codewalk-macos-x64.tar.gz | |
| artifacts/codewalk-android/codewalk-android-arm64.apk | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: false |