diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 8095443..47b3ae2 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -49,7 +49,11 @@ jobs: danielonyejesi/pediatric-ai-scribe-v3:latest cache-from: type=gha cache-to: type=gha,mode=max - platforms: linux/amd64,linux/arm64 + # x86 only — argon2 native build fails under QEMU ARM64 + # emulation on a GitHub-hosted amd64 runner (SIGILL / exit 132). + # Add linux/arm64 back with a native ARM runner when/if you + # actually deploy to ARM hardware. + platforms: linux/amd64 - name: Summary run: | diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml new file mode 100644 index 0000000..fe648c7 --- /dev/null +++ b/.github/workflows/version-bump.yml @@ -0,0 +1,99 @@ +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 + +permissions: + contents: write + +jobs: + bump: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ 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"