Skip to content

Commit f853d58

Browse files
author
Sunil Thaha
committed
ci: fix release workflow job
Signed-off-by: Sunil Thaha <sthaha@redhat.com>
1 parent 24b0456 commit f853d58

File tree

1 file changed

+60
-39
lines changed

1 file changed

+60
-39
lines changed

.github/workflows/release.yaml

Lines changed: 60 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ on:
55
inputs:
66
tag:
77
description: "Tag name, e.g. 0.4.0"
8-
default: 0.4.0
8+
default: 0.6.0
99
required: true
1010
release:
1111
description: "Release name, e.g. release-0.4.0"
12-
default: release-0.4.0
12+
default: release-0.6.0
1313
required: true
1414

15-
env:
16-
OPERATOR_IMAGE: "quay.io/sustainable_computing_io/kepler-operator"
17-
1815
jobs:
1916
build:
2017
name: Upload Release Asset
18+
permissions:
19+
contents: write
20+
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: Get current date
@@ -27,60 +27,81 @@ jobs:
2727
- name: Checkout code
2828
uses: actions/checkout@v2
2929

30-
- name: Create tag
31-
uses: actions/github-script@v5
30+
- name: Login to Quay
31+
uses: docker/login-action@v2
3232
with:
33-
script: |
34-
github.rest.git.createRef({
35-
owner: context.repo.owner,
36-
repo: context.repo.repo,
37-
ref: 'refs/tags/${{ github.event.inputs.tag }}',
38-
sha: context.sha
39-
})
40-
33+
registry: quay.io/sustainable_computing_io
34+
username: ${{ secrets.BOT_NAME }}
35+
password: ${{ secrets.BOT_TOKEN }}
36+
37+
- name: Git set user
38+
run: |
39+
git config user.name "$USERNAME"
40+
git config user.email "$USERNAME-[bot]@users.noreply.github.com"
41+
env:
42+
USERNAME: ${{ github.actor }}
43+
44+
45+
- name: Update the VERSION
46+
run: |
47+
echo "$VERSION" > VERSION
48+
env:
49+
VERSION: ${{ github.event.inputs.tag }}
50+
51+
- name: Build Operator
52+
run: |
53+
make operator-build
54+
env:
55+
IMG_BASE: ${{ vars.IMG_BASE }}
56+
57+
- name: Build Bundle
58+
run: |
59+
make bundle bundle-build
60+
env:
61+
IMG_BASE: ${{ vars.IMG_BASE }}
62+
63+
- name: Commit bundle changes and tag it
64+
run: |
65+
git add VERSION bundle
66+
git commit -m 'ci: update VERSION'
67+
git tag -a "v$VERSION" -m "$VERSION"
68+
git show --stat
69+
env:
70+
VERSION: ${{ github.event.inputs.tag }}
71+
72+
- name: Push Images
73+
run: |
74+
make operator-push bundle-push
75+
env:
76+
IMG_BASE: ${{ vars.IMG_BASE }}
77+
78+
- name: Push Release tag
79+
run: |
80+
git push --follow-tags
4181
4282
- name: Create Release
4383
id: create_release
4484
uses: actions/create-release@v1
4585
env:
4686
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4787
with:
48-
tag_name: ${{ github.event.inputs.tag }}
88+
tag_name: "v${{ github.event.inputs.tag }}"
4989
release_name: ${{ github.event.inputs.release }}
5090
draft: false
5191
prerelease: false
5292

53-
93+
5494
create-release-branch:
5595
name: Create release branch
96+
permissions:
97+
contents: write
5698
needs: [build]
5799
runs-on: ubuntu-latest
58-
steps:
100+
steps:
59101
- name: Create release branch
60102
uses: peterjgrainger/action-create-branch@v2.2.0
61103
env:
62104
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63105
with:
64106
branch: ${{ github.event.inputs.release }}
65107
sha: '${{ github.event.pull_request.head.sha }}'
66-
67-
68-
push-image:
69-
name: Push image to the registry
70-
needs: [build]
71-
runs-on: ubuntu-latest
72-
steps:
73-
- name: Checkout
74-
uses: actions/checkout@v3
75-
- name: Login to Quay
76-
uses: docker/login-action@v1
77-
with:
78-
registry: quay.io/sustainable_computing_io
79-
username: ${{ secrets.BOT_NAME }}
80-
password: ${{ secrets.BOT_TOKEN }}
81-
- name: make container
82-
run: make operator-build OPERATOR_IMG=${OPERATOR_IMAGE}:latest
83-
- name: push to quay
84-
run: |
85-
docker tag ${OPERATOR_IMAGE}:latest ${OPERATOR_IMAGE}:${{ github.event.inputs.tag }}
86-
docker push ${OPERATOR_IMAGE}:${{ github.event.inputs.tag }}

0 commit comments

Comments
 (0)