Skip to content

Commit f0f4acc

Browse files
authored
ci: fix build_and_push and release workflows (#213)
Signed-off-by: Niladri Halder <[email protected]>
1 parent 6e3659d commit f0f4acc

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

.github/workflows/build_and_push.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ jobs:
112112
runs-on: ubuntu-latest
113113
needs: ['integration-test']
114114
steps:
115+
- name: Checkout
116+
uses: actions/checkout@v4
117+
115118
- name: Set up Go 1.19
116119
uses: actions/setup-go@v5
117120
with:
@@ -125,6 +128,8 @@ jobs:
125128
126129
- name: Set CI Tag
127130
run: |
131+
BRANCH=${{ github.ref_name }}
132+
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
128133
CI_TAG=$(awk -F': ' '/^version:/ {print $2}' deploy/helm/charts/Chart.yaml)
129134
echo "TAG=${CI_TAG}" >> $GITHUB_ENV
130135
@@ -146,8 +151,9 @@ jobs:
146151
type=raw,value=latest,enable=false
147152
type=raw,value=${{ env.TAG }}
148153
149-
- name: Print Tags
154+
- name: Print Tag info
150155
run: |
156+
echo "BRANCH: ${{ env.BRANCH }}"
151157
echo "${{ steps.docker_meta.outputs.tags }}"
152158
153159
- name: Set up QEMU
@@ -198,6 +204,7 @@ jobs:
198204
DBUILD_DATE=${{ steps.date.outputs.DATE }}
199205
DBUILD_REPO_URL=https://github.com/openebs/dynamic-localpv-provisioner
200206
DBUILD_SITE_URL=https://openebs.io
207+
BRANCH=${{ env.BRANCH }}
201208
202209
release-chart:
203210
runs-on: ubuntu-latest

.github/workflows/release.yml

+22-9
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,29 @@ jobs:
141141
- name: Checkout
142142
uses: actions/checkout@v4
143143

144+
- uses: cachix/install-nix-action@v22
145+
- name: Pre-populate nix-shell
146+
run: |
147+
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
148+
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
149+
nix-shell --pure --run "echo" ./shell.nix
150+
151+
- name: Check if the chart is publishable
152+
run: |
153+
TAG=${{ github.event.release.tag_name }}
154+
nix-shell --pure --run "./scripts/update-chart-version.sh --tag $TAG --publish-release" ./shell.nix
155+
144156
- name: Set Image Org
145157
# sets the default IMAGE_ORG to openebs
146158
run: |
147159
[ -z "${{ secrets.IMAGE_ORG }}" ] && IMAGE_ORG=openebs || IMAGE_ORG=${{ secrets.IMAGE_ORG}}
148160
echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV
149161
150-
- name: Set Release Tag
162+
- name: Set IMAGE_TAG and BRANCH
151163
run: |
152-
TAG=$(shell awk -F': ' '/^version:/ {print $$2}' deploy/helm/charts/Chart.yaml)
153-
TAG="${GITHUB_REF#refs/*/v}"
154-
echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV
164+
BRANCH=${{ github.ref_name }}
165+
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
166+
echo "IMAGE_TAG=$(awk -F': ' '/^version:/ {print $2}' deploy/helm/charts/Chart.yaml)" >> $GITHUB_ENV
155167
156168
- name: Set Build Date
157169
id: date
@@ -168,12 +180,13 @@ jobs:
168180
quay.io/${{ env.IMAGE_ORG }}/provisioner-localpv
169181
ghcr.io/${{ env.IMAGE_ORG }}/provisioner-localpv
170182
tags: |
171-
type=semver,pattern={{version}}
183+
type=raw,value=latest,enable=false
184+
type=raw,value=${{ env.IMAGE_TAG }}
172185
173-
- name: Print Tags
186+
- name: Print Tag info
174187
run: |
175-
echo "${{ steps.docker_meta.outputs.tags }}"
176-
echo "RELEASE TAG: ${RELEASE_TAG}"
188+
echo "BRANCH: ${{ env.BRANCH }}"
189+
echo "RELEASE_TAG: ${{ steps.docker_meta.outputs.tags }}"
177190
178191
- name: Setup QEMU
179192
uses: docker/setup-qemu-action@v2
@@ -219,7 +232,7 @@ jobs:
219232
DBUILD_DATE=${{ steps.date.outputs.DATE }}
220233
DBUILD_REPO_URL=https://github.com/openebs/dynamic-localpv-provisioner
221234
DBUILD_SITE_URL=https://openebs.io
222-
RELEASE_TAG=${{ env.RELEASE_TAG }}
235+
BRANCH=${{ env.BRANCH }}
223236
224237
release-chart:
225238
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)