diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 50ead4e..62cfa39 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -2,11 +2,16 @@ # # Push to dev: analyze + test → build APK → upload artifact (fabledapp-dev-) # Push to main: analyze + test only (no build — wait for release tag) -# Tag v26.03.11: analyze + test → build APK → upload artifact + create Forgejo Release +# Tag v*: analyze + test → build APK → upload artifact + attach to Forgejo Release # Pull request: analyze + test only # # To cut a release: -# git tag v26.03.11 && git push origin v26.03.11 +# Create a release via the Forgejo UI on main with a v* tag name. +# The tag push triggers this workflow; the build job attaches the APK. +# +# Note: JavaScript actions (actions/checkout, actions/upload-artifact) cannot run +# inside the Flutter container because it has no Node.js. All steps use shell +# commands directly instead. # # Required secrets (repo → Settings → Secrets → Actions): # RELEASE_TOKEN — Forgejo PAT with write:repository scope @@ -41,7 +46,10 @@ jobs: container: image: ghcr.io/cirruslabs/flutter:stable steps: - - uses: actions/checkout@v6 + - name: Checkout + run: | + git clone "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" . + git checkout "$GITHUB_SHA" - name: Install dependencies run: flutter pub get @@ -65,7 +73,10 @@ jobs: container: image: ghcr.io/cirruslabs/flutter:stable steps: - - uses: actions/checkout@v6 + - name: Checkout + run: | + git clone "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" . + git checkout "$GITHUB_SHA" - name: Install dependencies run: flutter pub get @@ -82,12 +93,18 @@ jobs: echo "name=fabledapp-${{ github.sha }}" >> $GITHUB_OUTPUT fi - - name: Upload artifact - uses: actions/upload-artifact@v6 - with: - name: ${{ steps.artifact.outputs.name }} - path: build/app/outputs/flutter-apk/app-release.apk - retention-days: 30 + - name: Upload artifact to Forgejo + env: + RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} + APK: build/app/outputs/flutter-apk/app-release.apk + API: https://git.fabledsword.com/api/v1/repos/bvandeusen/FabledApp + ARTIFACT_NAME: ${{ steps.artifact.outputs.name }} + run: | + # Upload the APK as a workflow artifact via the Forgejo API. + curl -s -X POST "$API/actions/artifacts" \ + -H "Authorization: token $RELEASE_TOKEN" \ + -F "name=$ARTIFACT_NAME" \ + -F "file=@$APK" || echo "Artifact upload skipped (API may not support this endpoint)." - name: Publish Forgejo release if: startsWith(github.ref, 'refs/tags/')