Skip to content

Commit 534ed17

Browse files
authored
Merge pull request #5 from e0ne/updated-releases-support
Update release workflow to support image update
2 parents 0c1db39 + f131c1c commit 534ed17

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

.github/workflows/image-push-release.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@ on:
33
push:
44
tags:
55
- v*
6-
workflow_dispatch:
7-
inputs:
8-
version:
9-
description: CNI network pluging version
10-
required: true
116
jobs:
12-
push-amd64:
13-
name: Image push/amd64
7+
push-image:
8+
name: Image build and push
149
runs-on: ubuntu-latest
1510
steps:
1611
- name: Check out code into the Go module directory
@@ -39,6 +34,18 @@ jobs:
3934
flavor: |
4035
latest=false
4136
37+
- name: Discover CNI plugins version
38+
run: |
39+
echo "CNI_VERSION=$(echo ${{ github.ref_name }} | awk '{gsub(/-update.*$/,"")}1')" >> $GITHUB_ENV
40+
41+
- name: Validate CNI version
42+
run: |
43+
if [[ "${{ env.CNI_VERSION }}" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)?$ ]]; then
44+
echo "Valid CNI Version"
45+
else
46+
echo "Invalid CNI version/tag provided"
47+
exit 1
48+
fi
4249
- name: Build and push container image
4350
uses: docker/build-push-action@v4
4451
with:
@@ -47,6 +54,8 @@ jobs:
4754
"github_token=${{ secrets.GITHUB_TOKEN }}"
4855
platforms: linux/amd64,linux/arm64
4956
push: true
57+
build-args: |
58+
VERSION=${{ env.CNI_VERSION }}
5059
tags: |
51-
ghcr.io/k8snetworkplumbingwg/plugins:${{ github.event.inputs.version }}
60+
ghcr.io/k8snetworkplumbingwg/plugins:${{ github.ref_name }}
5261
file: ./Dockerfile

0 commit comments

Comments
 (0)