Skip to content

Commit 0fa8f87

Browse files
dfallingclaude
andcommitted
Cut a release on every push to main
Each main push now builds and publishes a signed APK as a GitHub Release tagged v0.0.<commit-count>. Tag-triggered runs keep their existing tag-derived version, and workflow_dispatch still produces just an artifact. Adds a per-ref concurrency group so back-to-back pushes serialize. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2e09a36 commit 0fa8f87

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@ name: Release APK
22

33
on:
44
push:
5+
branches:
6+
- main
57
tags:
68
- 'v*'
79
workflow_dispatch:
810

911
permissions:
1012
contents: write
1113

14+
# Serialize release builds on each ref so two near-simultaneous pushes don't
15+
# race for the same version tag. We don't cancel in-progress runs — a release
16+
# build mid-upload should finish before the next one starts.
17+
concurrency:
18+
group: release-${{ github.ref }}
19+
cancel-in-progress: false
20+
1221
jobs:
1322
build:
1423
runs-on: ubuntu-latest
@@ -45,12 +54,13 @@ jobs:
4554
- name: Compute version
4655
id: version
4756
run: |
57+
VERSION_CODE=$(git rev-list --count HEAD)
4858
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
4959
VERSION_NAME="${GITHUB_REF_NAME#v}"
5060
else
51-
VERSION_NAME="0.0.0-dev.${GITHUB_RUN_NUMBER}"
61+
# main pushes (and manual dispatch) get a commit-count-derived version.
62+
VERSION_NAME="0.0.${VERSION_CODE}"
5263
fi
53-
VERSION_CODE=$(git rev-list --count HEAD)
5464
echo "name=$VERSION_NAME" >> "$GITHUB_OUTPUT"
5565
echo "code=$VERSION_CODE" >> "$GITHUB_OUTPUT"
5666
echo "Building $VERSION_NAME (code $VERSION_CODE)"
@@ -98,9 +108,14 @@ jobs:
98108
if-no-files-found: error
99109

100110
- name: Create GitHub Release
101-
if: startsWith(github.ref, 'refs/tags/v')
111+
# Cut a release for both `main` pushes and `v*` tag pushes; skip for
112+
# workflow_dispatch (manual runs just produce the workflow artifact).
113+
if: github.event_name == 'push'
102114
uses: softprops/action-gh-release@v2
103115
with:
116+
# softprops will create the tag if it doesn't already exist.
117+
tag_name: v${{ steps.version.outputs.name }}
118+
target_commitish: ${{ github.sha }}
104119
files: artifacts/*.apk
105120
generate_release_notes: true
106121
fail_on_unmatched_files: true

0 commit comments

Comments
 (0)