From 54d3577fd3053379e3f5d46901a6be06907bb054 Mon Sep 17 00:00:00 2001 From: petegregoryy Date: Thu, 11 Dec 2025 14:31:00 +0000 Subject: [PATCH] Update .gitea/workflows/release.yml --- .gitea/workflows/release.yml | 212 ++++++++++++++++++++++++++++++++++- 1 file changed, 211 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 184085e..efd85dc 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -63,4 +63,214 @@ jobs: # Install required packages (also ignore SIGPIPE) yes | "$ANDROID_SDK_ROOT"/cmdline-tools/latest/bin/sdkmanager --sdk_root="$ANDROID_SDK_ROOT" \ - " + "platform-tools" "platforms;android-33" "build-tools;33.0.2" || true + + echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> "$GITHUB_ENV" + echo "$ANDROID_SDK_ROOT/platform-tools" >> "$GITHUB_PATH" + echo "$ANDROID_SDK_ROOT/build-tools/33.0.2" >> "$GITHUB_PATH" + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: ${{ env.FLUTTER_CHANNEL }} + + - name: Allow all git directories (CI) + run: git config --global --add safe.directory '*' + + - name: Flutter dependencies + run: flutter pub get + + - name: Build APK (release) + run: | + flutter build apk --release + cp build/app/outputs/flutter-apk/app-release.apk app-release.apk + + - name: Upload Android APK artifact + uses: actions/upload-artifact@v3 + with: + name: android-apk + path: app-release.apk + + linux-build: + runs-on: ubuntu-latest + needs: meta + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install OS deps (Linux desktop) + run: | + if command -v sudo >/dev/null 2>&1; then + SUDO="sudo" + else + SUDO="" + fi + $SUDO apt-get update + $SUDO apt-get install -y unzip xz-utils zip libstdc++6 libglu1-mesa clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev curl jq + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: ${{ env.FLUTTER_CHANNEL }} + + - name: Allow all git directories (CI) + run: git config --global --add safe.directory '*' + + - name: Flutter dependencies + run: flutter pub get + + - name: Enable Linux desktop + run: flutter config --enable-linux-desktop + + - name: Build Linux binary (release) + run: | + flutter build linux --release + tar -C build/linux/x64/release/bundle -czf app-linux-x64.tar.gz . + + - name: Upload Linux artifact + uses: actions/upload-artifact@v3 + with: + name: linux-bundle + path: app-linux-x64.tar.gz + + windows-build: + runs-on: windows-latest + needs: meta + # Job always runs; steps are conditional so release jobs aren't blocked when Windows is disabled. + steps: + - name: Checkout + if: ${{ env.BUILD_WINDOWS == 'true' }} + uses: actions/checkout@v4 + + - name: Setup Flutter + if: ${{ env.BUILD_WINDOWS == 'true' }} + uses: subosito/flutter-action@v2 + with: + channel: ${{ env.FLUTTER_CHANNEL }} + + - name: Allow all git directories (CI) + if: ${{ env.BUILD_WINDOWS == 'true' }} + run: git config --global --add safe.directory '*' + + - name: Flutter dependencies + if: ${{ env.BUILD_WINDOWS == 'true' }} + run: flutter pub get + + - name: Enable Windows desktop + if: ${{ env.BUILD_WINDOWS == 'true' }} + run: flutter config --enable-windows-desktop + + - name: Build Windows binary (release) + if: ${{ env.BUILD_WINDOWS == 'true' }} + run: | + flutter build windows --release + powershell -Command "Compress-Archive -Path build/windows/x64/runner/Release/* -DestinationPath app-windows-x64.zip" + + - name: Upload Windows artifact + if: ${{ env.BUILD_WINDOWS == 'true' }} + uses: actions/upload-artifact@v3 + with: + name: windows-zip + path: app-windows-x64.zip + + release-dev: + runs-on: ubuntu-latest + if: ${{ github.ref == 'refs/heads/dev' }} + needs: + - meta + - android-build + - linux-build + steps: + - name: Download Android APK + uses: actions/download-artifact@v3 + with: + name: android-apk + path: artifacts + + - name: Download Linux bundle + uses: actions/download-artifact@v3 + with: + name: linux-bundle + path: artifacts + + - name: Download Windows bundle (optional) + if: ${{ env.BUILD_WINDOWS == 'true' }} + uses: actions/download-artifact@v3 + with: + name: windows-zip + path: artifacts + + - name: Prepare artefacts and tag + id: bundle + run: | + BASE="${{ needs.meta.outputs.base_version }}" + TAG="v${BASE}-dev" + + mv artifacts/app-release.apk "artifacts/app-${BASE}-dev.apk" + mv artifacts/app-linux-x64.tar.gz "artifacts/app-linux-x64-${BASE}-dev.tar.gz" + if [ -f artifacts/app-windows-x64.zip ]; then + mv artifacts/app-windows-x64.zip "artifacts/app-windows-x64-${BASE}-dev.zip" + fi + + echo "tag=${TAG}" >> "$GITHUB_OUTPUT" + echo "files=artifacts/*" >> "$GITHUB_OUTPUT" + + - name: Create prerelease on Gitea + uses: ncipollo/release-action@v1 + with: + tag: ${{ steps.bundle.outputs.tag }} + name: ${{ steps.bundle.outputs.tag }} + prerelease: true + token: ${{ secrets.GITEA_TOKEN }} + artifacts: ${{ steps.bundle.outputs.files }} + + release-master: + runs-on: ubuntu-latest + if: ${{ github.ref == 'refs/heads/master' }} + needs: + - meta + - android-build + - linux-build + steps: + - name: Download Android APK + uses: actions/download-artifact@v3 + with: + name: android-apk + path: artifacts + + - name: Download Linux bundle + uses: actions/download-artifact@v3 + with: + name: linux-bundle + path: artifacts + + - name: Download Windows bundle (optional) + if: ${{ env.BUILD_WINDOWS == 'true' }} + uses: actions/download-artifact@v3 + with: + name: windows-zip + path: artifacts + + - name: Prepare artefacts and tag + id: bundle + run: | + BASE="${{ needs.meta.outputs.base_version }}" + TAG="v${BASE}" + + mv artifacts/app-release.apk "artifacts/app-${BASE}.apk" + mv artifacts/app-linux-x64.tar.gz "artifacts/app-linux-x64-${BASE}.tar.gz" + if [ -f artifacts/app-windows-x64.zip ]; then + mv artifacts/app-windows-x64.zip "artifacts/app-windows-x64-${BASE}.zip" + fi + + echo "tag=${TAG}" >> "$GITHUB_OUTPUT" + echo "files=artifacts/*" >> "$GITHUB_OUTPUT" + + - name: Create release on Gitea + uses: ncipollo/release-action@v1 + with: + tag: ${{ steps.bundle.outputs.tag }} + name: ${{ steps.bundle.outputs.tag }} + prerelease: false + token: ${{ secrets.GITEA_TOKEN }} + artifacts: ${{ steps.bundle.outputs.files }}