diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index ab15b1c..06b3cb0 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -136,72 +136,78 @@ jobs: windows-build: runs-on: windows-latest needs: meta - # Job always runs; individual steps are gated so release jobs can still depend on it. + # Job always runs; steps are conditional so release jobs can safely depend on it. steps: - name: Checkout - if: env.BUILD_WINDOWS == 'true' + if: ${{ env.BUILD_WINDOWS == 'true' }} uses: actions/checkout@v4 - name: Setup Flutter - if: env.BUILD_WINDOWS == 'true' + 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' + if: ${{ env.BUILD_WINDOWS == 'true' }} run: git config --global --add safe.directory '*' - name: Flutter dependencies - if: env.BUILD_WINDOWS == 'true' + if: ${{ env.BUILD_WINDOWS == 'true' }} run: flutter pub get - name: Enable Windows desktop - if: env.BUILD_WINDOWS == 'true' + if: ${{ env.BUILD_WINDOWS == 'true' }} run: flutter config --enable-windows-desktop - name: Build Windows binary (release) - if: env.BUILD_WINDOWS == 'true' + 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' + if: ${{ env.BUILD_WINDOWS == 'true' }} uses: actions/upload-artifact@v3 with: name: windows-zip path: app-windows-x64.zip release-dev: - if: github.ref_name == 'dev' runs-on: ubuntu-latest needs: - meta - android-build - linux-build + - windows-build steps: + - name: Note branch (dev release) + if: ${{ github.ref_name != 'dev' }} + run: echo "Not dev branch (${GITHUB_REF_NAME}), release-dev will be skipped." + - name: Download Android APK + if: ${{ github.ref_name == 'dev' }} uses: actions/download-artifact@v3 with: name: android-apk path: artifacts - name: Download Linux bundle + if: ${{ github.ref_name == 'dev' }} uses: actions/download-artifact@v3 with: name: linux-bundle path: artifacts - name: Download Windows bundle (optional) - if: env.BUILD_WINDOWS == 'true' + if: ${{ github.ref_name == 'dev' && env.BUILD_WINDOWS == 'true' }} uses: actions/download-artifact@v3 with: name: windows-zip path: artifacts - if-no-files-found: ignore - name: Prepare artefacts and tag + if: ${{ github.ref_name == 'dev' }} id: bundle run: | BASE="${{ needs.meta.outputs.base_version }}" @@ -214,10 +220,10 @@ jobs: fi echo "tag=${TAG}" >> "$GITHUB_OUTPUT" - # upload everything in artifacts/ echo "files=artifacts/*" >> "$GITHUB_OUTPUT" - name: Create prerelease on Gitea + if: ${{ github.ref_name == 'dev' }} uses: ncipollo/release-action@v1 with: tag: ${{ steps.bundle.outputs.tag }} @@ -227,7 +233,6 @@ jobs: artifacts: ${{ steps.bundle.outputs.files }} release-master: - if: github.ref_name == 'master' runs-on: ubuntu-latest needs: - meta @@ -235,47 +240,16 @@ jobs: - linux-build - windows-build steps: + - name: Note branch (master release) + if: ${{ github.ref_name != 'master' }} + run: echo "Not master branch (${GITHUB_REF_NAME}), release-master will be skipped." + - name: Download Android APK + if: ${{ github.ref_name == 'master' }} 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 - if-no-files-found: ignore - - - 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" - # upload everything in artifacts/ - 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 }} + if: ${{ github.ref_name == 'master' }}