Skip to content

Commit 1800e5e

Browse files
committed
workflow: tag promotion to action version
1 parent 6d0f61a commit 1800e5e

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Copied from https://github.com/actions/checkout/blob/85e6279cec87321a52edac9c87bce653a07cf6c2/.github/workflows/update-main-version.yml#L1
2+
# actions/checkout is MIT licensed. See https://github.com/actions/checkout/blob/main/LICENSE
3+
name: Publish Action Major Tag
4+
run-name: Publish ${{ github.event.inputs.major_version }} from ${{ github.event.inputs.target }}
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
target:
10+
description: The tag or reference to use
11+
required: true
12+
major_version:
13+
type: choice
14+
description: The major version to update
15+
options:
16+
- v3
17+
- v2
18+
- v1
19+
20+
jobs:
21+
tag:
22+
runs-on: ubuntu-latest
23+
steps:
24+
# Note this update workflow can also be used as a rollback tool.
25+
# For that reason, it's best to pin `actions/checkout` to a known, stable version
26+
# (typically, about two releases back).
27+
- uses: actions/[email protected]
28+
with:
29+
fetch-depth: 0
30+
- name: Check major_version matches action.yml image
31+
run: |
32+
set -e
33+
# Get the major_version (e.g., from env or input)
34+
MAJOR_VERSION="${{ github.event.inputs.major_version }}"
35+
# Extract the version from line 31 of action.yml
36+
IMAGE_VERSION=$(sed -nE 's/^ *image: docker:\/\/jimschubert\/beast-changelog-action:(v[0-9]+).*/\1/p' action.yml)
37+
if [ "$MAJOR_VERSION" != "$IMAGE_VERSION" ]; then
38+
echo "Error: major_version ($MAJOR_VERSION) does not match image version ($IMAGE_VERSION) in action.yml"
39+
exit 1
40+
fi
41+
- name: Git config
42+
run: |
43+
git config user.name "Jim Schubert"
44+
git config user.email "[email protected]"
45+
- name: Tag new target
46+
run: git tag -f ${{ github.event.inputs.major_version }} ${{ github.event.inputs.target }}
47+
- name: Push new tag
48+
run: git push origin ${{ github.event.inputs.major_version }} --force

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,6 @@ branding:
7575
color: 'yellow'
7676
runs:
7777
using: docker
78-
image: docker://jimschubert/beast-changelog-action:latest
78+
image: docker://jimschubert/beast-changelog-action:v1
7979
# image: Dockerfile
8080

0 commit comments

Comments
 (0)