ci: only trigger on v* release tags, never on branch pushes

This commit is contained in:
2026-03-12 00:24:59 -04:00
parent 3a336ddf88
commit c8f3861eb5
+3 -35
View File
@@ -1,9 +1,6 @@
# CI runs first; build only proceeds if analyze and test pass. # CI runs only on release tags.
# #
# Push to dev: analyze + test → build APK → upload artifact (fabledapp-dev-<sha>) # Tag v*: analyze + test → build APK → attach to Forgejo Release
# Push to main: analyze + test only (no build — wait for release tag)
# Tag v*: analyze + test → build APK → upload artifact + attach to Forgejo Release
# Pull request: analyze + test only
# #
# To cut a release: # To cut a release:
# Create a release via the Forgejo UI on main with a v* tag name. # Create a release via the Forgejo UI on main with a v* tag name.
@@ -19,25 +16,7 @@ name: CI & Build
on: on:
push: push:
branches: [main, dev]
tags: ["v*"] tags: ["v*"]
paths:
- "lib/**"
- "test/**"
- "pubspec.yaml"
- "pubspec.lock"
- "analysis_options.yaml"
- "android/**"
- "assets/**"
- ".forgejo/workflows/ci.yml"
pull_request:
paths:
- "lib/**"
- "test/**"
- "pubspec.yaml"
- "pubspec.lock"
- "analysis_options.yaml"
- ".forgejo/workflows/ci.yml"
jobs: jobs:
analyze: analyze:
@@ -63,12 +42,6 @@ jobs:
build: build:
name: Build release APK name: Build release APK
needs: [analyze] needs: [analyze]
# Build on dev branch pushes and version tag pushes only.
# main branch pushes run CI for safety but do not build —
# the release tag (v*) is the sole trigger for a production APK.
if: |
github.event_name == 'push' &&
(github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/'))
runs-on: py3.12-node22 runs-on: py3.12-node22
container: container:
image: ghcr.io/cirruslabs/flutter:stable image: ghcr.io/cirruslabs/flutter:stable
@@ -87,11 +60,7 @@ jobs:
- name: Set artifact name - name: Set artifact name
id: artifact id: artifact
run: | run: |
if [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then echo "name=fabledapp-${{ github.ref_name }}-${{ github.sha }}" >> $GITHUB_OUTPUT
echo "name=fabledapp-dev-${{ github.sha }}" >> $GITHUB_OUTPUT
else
echo "name=fabledapp-${{ github.sha }}" >> $GITHUB_OUTPUT
fi
- name: Upload artifact to Forgejo - name: Upload artifact to Forgejo
env: env:
@@ -107,7 +76,6 @@ jobs:
-F "file=@$APK" || echo "Artifact upload skipped (API may not support this endpoint)." -F "file=@$APK" || echo "Artifact upload skipped (API may not support this endpoint)."
- name: Publish Forgejo release - name: Publish Forgejo release
if: startsWith(github.ref, 'refs/tags/')
env: env:
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
TAG: ${{ github.ref_name }} TAG: ${{ github.ref_name }}