Skip to content

Commit 42260f7

Browse files
committed
Switch action publishing to rolling release tag
1 parent 0f8f4f1 commit 42260f7

2 files changed

Lines changed: 33 additions & 40 deletions

File tree

.github/workflows/publish-action.yml

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ name: Publish Action
33
on:
44
workflow_dispatch:
55
inputs:
6-
version:
7-
description: "Semantic version without prefix (example: 1.0.0)"
8-
required: true
9-
update_major_tag:
10-
description: "Also update moving major tag (action-v1, action-v2, ...)"
6+
release_tag:
7+
description: "Rolling action tag to update (example: action-v1)"
118
required: false
12-
default: "true"
9+
default: "action-v1"
1310

1411
jobs:
1512
publish:
@@ -23,28 +20,23 @@ jobs:
2320
with:
2421
fetch-depth: 0
2522

26-
- name: Validate version and compute tags
23+
- name: Validate and compute tag
2724
id: vars
2825
shell: bash
2926
run: |
3027
set -euo pipefail
3128
32-
version="${{ inputs.version }}"
33-
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
34-
echo "Invalid version '$version'. Use semantic version format x.y.z." >&2
35-
exit 1
29+
release_tag="${{ inputs.release_tag }}"
30+
if [[ -z "$release_tag" ]]; then
31+
release_tag="action-v1"
3632
fi
3733
38-
full_tag="action-v${version}"
39-
major_tag="action-v${version%%.*}"
40-
41-
if git rev-parse "$full_tag" >/dev/null 2>&1; then
42-
echo "Tag already exists: $full_tag" >&2
34+
if [[ ! "$release_tag" =~ ^action-v[0-9]+$ ]]; then
35+
echo "Invalid release tag '$release_tag'. Use format action-v<major> (example: action-v1)." >&2
4336
exit 1
4437
fi
4538
46-
echo "full_tag=$full_tag" >> "$GITHUB_OUTPUT"
47-
echo "major_tag=$major_tag" >> "$GITHUB_OUTPUT"
39+
echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT"
4840
4941
- name: Configure git user
5042
shell: bash
@@ -53,27 +45,29 @@ jobs:
5345
git config user.name "github-actions[bot]"
5446
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
5547
56-
- name: Create immutable release tag
57-
shell: bash
58-
run: |
59-
set -euo pipefail
60-
git tag -a "${{ steps.vars.outputs.full_tag }}" -m "Action release ${{ steps.vars.outputs.full_tag }}"
61-
git push origin "${{ steps.vars.outputs.full_tag }}"
62-
63-
- name: Update major moving tag
64-
if: ${{ inputs.update_major_tag == 'true' }}
48+
- name: Update rolling release tag
6549
shell: bash
6650
run: |
6751
set -euo pipefail
68-
git tag -fa "${{ steps.vars.outputs.major_tag }}" -m "Action major tag -> ${{ steps.vars.outputs.full_tag }}"
69-
git push origin "${{ steps.vars.outputs.major_tag }}" --force
52+
git tag -fa "${{ steps.vars.outputs.release_tag }}" -m "Action release ${{ steps.vars.outputs.release_tag }}"
53+
git push origin "${{ steps.vars.outputs.release_tag }}" --force
7054
71-
- name: Create GitHub release
55+
- name: Upsert GitHub release
7256
env:
7357
GH_TOKEN: ${{ github.token }}
7458
shell: bash
7559
run: |
7660
set -euo pipefail
77-
gh release create "${{ steps.vars.outputs.full_tag }}" \
78-
--title "JAIPilot Action ${{ steps.vars.outputs.full_tag }}" \
79-
--notes "Release of JAIPilot GitHub Action."
61+
release_tag="${{ steps.vars.outputs.release_tag }}"
62+
release_title="JAIPilot Action ${release_tag}"
63+
release_notes="Rolling release for ${release_tag}. Updated from commit ${GITHUB_SHA::7} on $(date -u +'%Y-%m-%d %H:%M:%S UTC')."
64+
65+
if gh release view "$release_tag" >/dev/null 2>&1; then
66+
gh release edit "$release_tag" \
67+
--title "$release_title" \
68+
--notes "$release_notes"
69+
else
70+
gh release create "$release_tag" \
71+
--title "$release_title" \
72+
--notes "$release_notes"
73+
fi

docs/github-action-publishing.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,23 @@ The action automatically:
6161
- commits generated test changes
6262
- pushes the commit back to the same branch that triggered the workflow
6363

64-
## Publish a new action release
64+
## Publish the rolling action release
6565

6666
1. Open Actions tab.
6767
2. Run `Publish Action` workflow manually.
68-
3. Pass version in `x.y.z` format (for example, `1.0.0`).
68+
3. Keep `release_tag` as `action-v1` (or set another major channel like `action-v2`).
6969

7070
The workflow will:
7171

72-
- create immutable tag `action-vx.y.z`
73-
- optionally update moving major tag `action-vx`
74-
- create a GitHub Release for `action-vx.y.z`
72+
- force-update the rolling tag (default: `action-v1`) to the latest commit
73+
- create the GitHub Release the first time, then update that same release on later publishes
7574

7675
## Publish in GitHub Marketplace
7776

7877
1. Ensure repository is public.
79-
2. Open your release tag page (`action-vx.y.z`).
78+
2. Open your release tag page (`action-v1` by default).
8079
3. Publish the action to Marketplace from the release flow.
81-
4. Keep users pinned to the major tag (`@action-v1`).
80+
4. Keep users pinned to the same major tag (`@action-v1`).
8281

8382
## Why tags are prefixed with `action-`
8483

0 commit comments

Comments
 (0)