ci(release): add a workflow_dispatch retry path for releases
dev / Build debug APK (push) Successful in 21s
dev / Build debug APK (push) Successful in 21s
A tag push pins the workflow file to the tag's own commit, so re-running a red release run replays the OLD workflow even when main is already fixed - that is precisely why run 78 kept dying on the cp bug after the fix landed, and each retry deleted the changelog asset before failing to re-upload it. Adds workflow_dispatch with a required 'tag' input plus a RELEASE_TAG env (input on dispatch, tag name on push) used by both checkouts and the release step, so a release can be re-published from main's current workflow against any existing tag. The checkout also gains a targeted shallow fetch of the tag, since a --depth=1 default-branch clone may not carry the tag's commit when dispatched from main.
This commit is contained in:
1 parent
cbebac3254
commit
c8c2c98c8e
1 file changed
+22
-3
@@ -4,19 +4,38 @@ on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
# Retry path: a tag push pins the workflow file to that tag's commit, so a
|
||||
# re-run of a red release run replays the OLD workflow even after main is
|
||||
# fixed (that is exactly how run 78 kept failing post-fix). Dispatching
|
||||
# against main runs main's current workflow against any already-published
|
||||
# tag, so a release can be re-published without moving a tag.
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Existing tag to rebuild and re-publish, e.g. v0.3.8.1'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build-release:
|
||||
name: Build & attach release APK
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
# The tag this run publishes: the tag itself on a push, or the typed
|
||||
# input on a manual retry (where github.ref_name is just the branch).
|
||||
RELEASE_TAG: ${{ github.event.inputs.tag || github.ref_name }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
run: |
|
||||
git clone --depth=1 https://git.trevena.info/nick/incido.git repo
|
||||
cd repo
|
||||
# Targeted shallow fetch of the exact tag: the clone above is shallow
|
||||
# off the default branch, so --tags alone may not carry the tag's
|
||||
# commit when the run is dispatched from main instead of pushed.
|
||||
git fetch --depth=1 origin tag "$RELEASE_TAG" || true
|
||||
git fetch --tags origin
|
||||
git checkout ${{ github.ref_name }}
|
||||
git checkout "$RELEASE_TAG"
|
||||
|
||||
- name: Set up JDK 17
|
||||
run: |
|
||||
@@ -57,7 +76,7 @@ jobs:
|
||||
timeout-minutes: 25
|
||||
run: |
|
||||
cd repo
|
||||
git checkout ${{ github.ref_name }}
|
||||
git checkout "$RELEASE_TAG"
|
||||
# Persistent signing keystore: minted ONCE in the runner's
|
||||
# cache dir (which survives across runs, same place the JDK
|
||||
# and SDK live) and copied into the checkout. Every release
|
||||
@@ -101,7 +120,7 @@ jobs:
|
||||
run: |
|
||||
set -e
|
||||
cd repo
|
||||
TAG="${{ github.ref_name }}"
|
||||
TAG="$RELEASE_TAG"
|
||||
VERSION="${TAG#v}"
|
||||
API="http://192.168.8.17:3000/api/v1/repos/nick/incido"
|
||||
APK_DEBUG="Incido-$VERSION-debug.apk"
|
||||
|
||||
Reference in new issue
Block a user