Skip to content

Commit 3527d43

Browse files
committed
git tag step
1 parent 4ae0a9c commit 3527d43

1 file changed

Lines changed: 24 additions & 17 deletions

File tree

.github/workflows/build-release-candidate.yml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
1-
name: Build release candidate (`-rc`) images
1+
name: Build release candidate images
22

33
on:
4-
push:
5-
branches:
6-
- jw/release-doc
74
workflow_dispatch:
85
inputs:
96
ref:
107
description: "Git ref to build from"
118
default: main
129
version:
1310
description: "Release version (e.g. 1.4.0)"
14-
# required: true
15-
default: "1.4.0"
11+
required: true
1612
rc:
1713
description: "RC number (e.g. rc.1)"
18-
# required: true
19-
default: "rc.1"
14+
required: true
2015
dry_run:
21-
description: "If true, skip pushing images and creating release"
16+
description: "If true, skip pushing images and creating GitHub release"
2217
type: boolean
23-
default: true
18+
default: true # TODO: change to `false` once validated
2419

2520
jobs:
2621
rc-release:
@@ -68,7 +63,7 @@ jobs:
6863
run: |
6964
echo "owner=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
7065
71-
- name: Determine RC image tags
66+
- name: Determine RC Docker image tags
7267
id: vars
7368
run: |
7469
VERSION="${{ github.event.inputs.version }}"
@@ -84,15 +79,27 @@ jobs:
8479
echo "lambda_tags=$GHCR_LAMBDA:$TAG" >> $GITHUB_OUTPUT
8580
echo "ops_tags=$GHCR_OPS:$TAG" >> $GITHUB_OUTPUT
8681
87-
- name: Debug RC tags
88-
if: ${{ github.event.inputs.dry_run == 'true' }}
82+
- name: Print RC Docker image tags
8983
run: |
90-
echo "===== RC IMAGE TAGS (DRY RUN) ====="
84+
echo "===== RC IMAGE TAGS ====="
9185
echo "App: ${{ steps.vars.outputs.app_tags }}"
9286
echo "Lambda: ${{ steps.vars.outputs.lambda_tags }}"
9387
echo "Ops: ${{ steps.vars.outputs.ops_tags }}"
9488
echo "=================================="
9589
90+
- name: Create and push RC Git tag
91+
if: ${{ github.event.inputs.dry_run == 'false' }}
92+
id: rc_git_tag
93+
run: |
94+
GIT_TAG="v${{ github.event.inputs.version }}-${{ github.event.inputs.rc }}"
95+
if git rev-parse "$GIT_TAG" >/dev/null 2>&1; then
96+
echo "Tag $GIT_TAG already exists, skipping"
97+
else
98+
git tag -a "$GIT_TAG" -m "Release candidate $GIT_TAG"
99+
git push origin "$GIT_TAG"
100+
fi
101+
echo "git_tag=$GIT_TAG" >> $GITHUB_OUTPUT
102+
96103
- name: Build/push Refiner App RC image to GHCR
97104
uses: docker/build-push-action@v6
98105
with:
@@ -122,12 +129,12 @@ jobs:
122129
push: ${{ github.event.inputs.dry_run == 'false' }}
123130
tags: ${{ steps.vars.outputs.ops_tags }}
124131

125-
- name: Create draft GitHub release
132+
- name: Create draft pre-release GitHub release notes
126133
if: ${{ github.event.inputs.dry_run == 'false' }}
127134
uses: softprops/action-gh-release@v2
128135
with:
129-
tag_name: v${{ github.event.inputs.version }}-${{ github.event.inputs.rc }}
130-
name: v${{ github.event.inputs.version }}-${{ github.event.inputs.rc }}
136+
tag_name: ${{ steps.rc_git_tag.outputs.git_tag }}
137+
name: ${{ steps.rc_git_tag.outputs.git_tag }}
131138
draft: true
132139
prerelease: true
133140
generate_release_notes: true

0 commit comments

Comments
 (0)