pediatric-ai-scribe-v3/.github/workflows/version-bump.yml
Daniel 7ad0c84789 ci: multi-arch Docker via native runners + Node 24 opt-in + PAT for tag-trigger chain
docker-publish.yml:
  - Rewrote as matrix build + manifest merge.
  - amd64 on ubuntu-latest, arm64 on ubuntu-24.04-arm (free for public
    repos). No QEMU — argon2 and every other native dep compile on
    their target CPU, no more SIGILL / exit 132.
  - Per-arch GHA cache scopes so builds don't thrash each other.
  - Final step merges both digests under one tag (vX.Y.Z + latest),
    publishing a real multi-arch manifest. `docker pull` from either
    arch gets the right variant automatically.

auto-version.yml, version-bump.yml:
  - Checkout now uses `secrets.RELEASE_PAT || secrets.GITHUB_TOKEN`.
    With RELEASE_PAT set, the tag push this workflow does DOES
    trigger downstream (android-release, docker-publish). Without
    it, falls back to GITHUB_TOKEN (no downstream trigger, what we
    have today).

All workflows (auto-version, version-bump, android-release,
docker-publish):
  - Added FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true' so actions
    still on Node 20 runtime (checkout/cache/setup-*) opt in to
    Node 24 early. GitHub makes Node 24 default 2026-06-02 and
    removes Node 20 2026-09-16.

To finish the chain (one-time user step): create a fine-grained
PAT with "Contents: Read and write" on this repo and add as
RELEASE_PAT secret. After that `feat:` / `fix:` commits auto-tag
AND auto-build with zero manual intervention.
2026-04-15 00:05:34 +02:00

102 lines
3.4 KiB
YAML

name: Version bump & release
# Manual trigger — click "Run workflow" in the Actions tab, choose
# patch / minor / major. The workflow computes the next semver,
# updates package.json, mobile/package.json, and the Android
# build.gradle, commits the change, tags it, and pushes — which
# triggers the android-release and docker-publish workflows.
on:
workflow_dispatch:
inputs:
bump:
description: 'Semver bump type'
required: true
type: choice
default: patch
options:
- patch
- minor
- major
custom:
description: 'Or exact version (e.g. 7.0.0) — overrides bump'
required: false
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
permissions:
contents: write
jobs:
bump:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_PAT || secrets.GITHUB_TOKEN }}
- name: Compute next version
id: v
run: |
CUR=$(grep -m1 '"version"' package.json | sed -E 's/.*"version"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/')
echo "current=$CUR"
IFS='.' read -r MAJ MIN PAT <<< "$CUR"
if [[ -n "${{ github.event.inputs.custom }}" ]]; then
NEXT="${{ github.event.inputs.custom }}"
else
case "${{ github.event.inputs.bump }}" in
major) NEXT="$((MAJ+1)).0.0" ;;
minor) NEXT="${MAJ}.$((MIN+1)).0" ;;
patch) NEXT="${MAJ}.${MIN}.$((PAT+1))" ;;
esac
fi
if ! [[ "$NEXT" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::invalid version: $NEXT"; exit 1
fi
echo "next=$NEXT" >> "$GITHUB_OUTPUT"
echo "current=$CUR" >> "$GITHUB_OUTPUT"
echo "### Version bump" >> "$GITHUB_STEP_SUMMARY"
echo "- Current: $CUR" >> "$GITHUB_STEP_SUMMARY"
echo "- Next: $NEXT" >> "$GITHUB_STEP_SUMMARY"
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Bump version strings
env:
V: ${{ steps.v.outputs.next }}
run: |
IFS='.' read -r MAJ MIN PAT <<< "$V"
ANDROID_CODE=$(( MAJ * 100000 + MIN * 1000 + PAT ))
# package.json (top-level "version": "...")
sed -i -E "0,/(\"version\"[[:space:]]*:[[:space:]]*\")[^\"]+(\")/ s//\1${V}\2/" package.json
sed -i -E "0,/(\"version\"[[:space:]]*:[[:space:]]*\")[^\"]+(\")/ s//\1${V}\2/" mobile/package.json
# Android
sed -i -E \
-e "s/versionCode +[0-9]+/versionCode ${ANDROID_CODE}/" \
-e "s/versionName +\"[^\"]+\"/versionName \"${V}\"/" \
mobile/android/app/build.gradle
git diff --stat
- name: Commit, tag, push
env:
V: ${{ steps.v.outputs.next }}
run: |
git add package.json mobile/package.json mobile/android/app/build.gradle
git commit -m "Release v${V}"
git tag -a "v${V}" -m "Release v${V}"
git push origin HEAD
git push origin "v${V}"
echo "### Pushed" >> "$GITHUB_STEP_SUMMARY"
echo "- tag: v${V}" >> "$GITHUB_STEP_SUMMARY"
echo "- android-release + docker-publish workflows will now run" >> "$GITHUB_STEP_SUMMARY"