Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/bump-patch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ on:
required: false
default: false
type: boolean
skip_bump:
description: 'Record the manifest without bumping the patch version (e.g. Packaging.kt is already ahead)'
required: false
default: false
type: boolean

jobs:
release:
Expand All @@ -44,6 +49,7 @@ jobs:
SERVICE_ACCOUNT_KEY_JSON: ${{ steps.service_account_json_file.outputs.filePath }}
TRACKS: ${{ github.event.inputs.track }}
FORCE_BUMP: ${{ github.event.inputs.force_bump }}
SKIP_BUMP: ${{ github.event.inputs.skip_bump }}
run: bash scripts/update-release-manifest.sh

- name: Commit & Push changes
Expand All @@ -54,11 +60,13 @@ jobs:
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
COMMIT_MSG="${{ steps.manifest.outputs.prod_changed == 'true'
COMMIT_MSG="${{ steps.manifest.outputs.prod_changed == 'true' && steps.manifest.outputs.skipped == 'true'
&& format('build: release Flipcash {0} ({1})', steps.manifest.outputs.new_prod_name, steps.manifest.outputs.new_prod)
|| (steps.manifest.outputs.prod_changed == 'true'
&& format('build: release Flipcash {0} ({1}), bump to {2}', steps.manifest.outputs.new_prod_name, steps.manifest.outputs.new_prod, steps.manifest.outputs.version)
|| (steps.manifest.outputs.forced == 'true'
&& format('build: bump Flipcash to {0}', steps.manifest.outputs.version)
|| 'build: update release manifest') }}"
|| 'build: update release manifest')) }}"
git commit -m "$COMMIT_MSG"
git pull --rebase https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git code/cash
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git HEAD:code/cash
21 changes: 19 additions & 2 deletions scripts/update-release-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# updates .well-known/release-manifest.json in place, and bumps
# Flipcash.patchVersion in Packaging.kt when production changes.
#
# FORCE_BUMP=true bumps the patch even when production is unchanged.
# SKIP_BUMP=true records the tracks without bumping, for when Packaging.kt
# is already ahead of the release being recorded. Setting both is an error.
#
# Env:
# SERVICE_ACCOUNT_KEY_JSON — path to the Google service account JSON file
# PKG — package name (default: com.flipcash.app.android)
Expand All @@ -16,7 +20,8 @@
# Outputs (written to $GITHUB_OUTPUT when running in CI):
# old_prod / new_prod — previous and current production versionCode
# prod_changed — "true" | "false"
# version — new versionName (only when prod_changed=true)
# version — new versionName (only when the patch was bumped)
# skipped — "true" when SKIP_BUMP suppressed a bump

set -euo pipefail

Expand All @@ -33,6 +38,11 @@ PKG="${PKG:-com.flipcash.app.android}"
MANIFEST_PATH="${MANIFEST_PATH:-.well-known/release-manifest.json}"
TRACKS="${TRACKS:-production beta alpha internal}"
FORCE_BUMP="${FORCE_BUMP:-false}"
SKIP_BUMP="${SKIP_BUMP:-false}"

if [ "$FORCE_BUMP" = "true" ] && [ "$SKIP_BUMP" = "true" ]; then
echo "FORCE_BUMP and SKIP_BUMP cannot both be set"; exit 1
fi

ALL_TRACKS="production beta alpha internal"

Expand All @@ -42,7 +52,7 @@ in_list() { [[ " $2 " == *" $1 "* ]]; }
# --- helper: write to $GITHUB_OUTPUT when in CI, otherwise just print ---
emit() {
echo "$1=$2"
[ -n "${GITHUB_OUTPUT:-}" ] && echo "$1=$2" >> "$GITHUB_OUTPUT"
if [ -n "${GITHUB_OUTPUT:-}" ]; then echo "$1=$2" >> "$GITHUB_OUTPUT"; fi
}

# --- mint access token ---
Expand Down Expand Up @@ -162,6 +172,13 @@ if [ "$FORCE_BUMP" != "true" ] && [ "$PROD_CHANGED" != "true" ]; then
fi

emit "prod_changed" "$PROD_CHANGED"

if [ "$SKIP_BUMP" = "true" ]; then
echo "skip_bump set, recording the manifest without a patch bump"
emit "skipped" "true"
exit 0
fi

emit "forced" "$FORCE_BUMP"
echo "Bumping patch version (prod_changed=$PROD_CHANGED, forced=$FORCE_BUMP)"

Expand Down
Loading