Skip to content

Commit b8e7db8

Browse files
committed
ci: ensure version PR is tagged when making a release
This commit ensures that the Pull request is tagged with the version number when a release is made. Signed-off-by: vprashar2929 <[email protected]>
1 parent 7c863bd commit b8e7db8

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

.github/workflows/release.yaml

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,80 +11,60 @@ on: # yamllint disable-line rule:truthy
1111
description: Version to be replaced in bundle, e.g. 0.7.3
1212
default:
1313
required: true
14-
1514
jobs:
1615
build:
1716
name: Upload Release Asset
1817
permissions:
1918
contents: write
2019
pull-requests: write
2120
issues: write
22-
2321
runs-on: ubuntu-latest-8-cores
2422
steps:
2523
- name: Get current date
2624
id: date
2725
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
28-
2926
- name: Checkout source
3027
uses: actions/checkout@v4
31-
3228
- name: Login to Quay
3329
uses: docker/login-action@v2
3430
with:
3531
registry: quay.io/sustainable_computing_io
3632
username: ${{ secrets.BOT_NAME }}
3733
password: ${{ secrets.BOT_TOKEN }}
38-
3934
- name: Update the VERSION
4035
run: |
4136
echo "$VERSION" > VERSION
4237
env:
4338
VERSION: ${{ github.event.inputs.tag }}
44-
4539
- name: Install all tools
4640
uses: ./.github/tools-cache
47-
4841
- name: Build Operator
4942
run: |
5043
make operator-build
5144
env:
5245
IMG_BASE: ${{ vars.IMG_BASE }}
53-
5446
- name: Build Bundle
5547
run: |
5648
make bundle bundle-build
5749
env:
5850
IMG_BASE: ${{ vars.IMG_BASE }}
5951
VERSION_REPLACED: ${{ github.event.inputs.version-replace }}
60-
6152
- name: Git set user
6253
run: |
6354
git config user.name "$USERNAME"
6455
git config user.email "$USERNAME-[bot]@users.noreply.github.com"
6556
env:
6657
USERNAME: ${{ github.actor }}
67-
68-
- name: Tag the release
69-
run: |
70-
git tag -a "v${{ github.event.inputs.tag }}" -m "v${{ github.event.inputs.tag }}"
71-
git show --stat
72-
7358
- name: Output the version
7459
run: |
7560
cat VERSION
76-
7761
- name: Push Images
7862
run: |
7963
make operator-push bundle-push
8064
env:
8165
IMG_BASE: ${{ vars.IMG_BASE }}
82-
83-
- name: Push Release tag
84-
run: |
85-
git push --tags
86-
8766
- name: Create Pull Request
67+
id: create_pr
8868
uses: peter-evans/create-pull-request@v7
8969
with:
9070
token: ${{ secrets.GITHUB_TOKEN }}
@@ -107,7 +87,15 @@ jobs:
10787
vprashar2929
10888
KaiyiLiu1234
10989
draft: false
110-
90+
- name: Tag the release
91+
run: |
92+
TAG_SHA="${{ steps.create_pr.outputs.pull-request-head-sha }}"
93+
git fetch origin chore-version-${{ github.event.inputs.tag }}
94+
git tag -a "v${{ github.event.inputs.tag }}" "$TAG_SHA" -m "v${{ github.event.inputs.tag }}"
95+
git show --stat "v${{ github.event.inputs.tag }}"
96+
- name: Push Release tag
97+
run: |
98+
git push --tags
11199
- name: Create Release
112100
uses: softprops/action-gh-release@v2
113101
env:

0 commit comments

Comments
 (0)