ci: only trigger on v* release tags, never on branch pushes
This commit is contained in:
@@ -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>)
|
||||
# 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
|
||||
# Tag v*: analyze + test → build APK → attach to Forgejo Release
|
||||
#
|
||||
# To cut a release:
|
||||
# Create a release via the Forgejo UI on main with a v* tag name.
|
||||
@@ -19,25 +16,7 @@ name: CI & Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, dev]
|
||||
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:
|
||||
analyze:
|
||||
@@ -63,12 +42,6 @@ jobs:
|
||||
build:
|
||||
name: Build release APK
|
||||
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
|
||||
container:
|
||||
image: ghcr.io/cirruslabs/flutter:stable
|
||||
@@ -87,11 +60,7 @@ jobs:
|
||||
- name: Set artifact name
|
||||
id: artifact
|
||||
run: |
|
||||
if [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
|
||||
echo "name=fabledapp-dev-${{ github.sha }}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "name=fabledapp-${{ github.sha }}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
echo "name=fabledapp-${{ github.ref_name }}-${{ github.sha }}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Upload artifact to Forgejo
|
||||
env:
|
||||
@@ -107,7 +76,6 @@ jobs:
|
||||
-F "file=@$APK" || echo "Artifact upload skipped (API may not support this endpoint)."
|
||||
|
||||
- name: Publish Forgejo release
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
TAG: ${{ github.ref_name }}
|
||||
|
||||
Reference in New Issue
Block a user