Skip to content

Commit 019dc58

Browse files
config: Update workflow file to build image on specific version release
1 parent 26b454f commit 019dc58

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

.github/workflows/action.yaml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
name: Build and Push Docker Image for Helm Client
2+
23
on:
34
push:
45
branches:
5-
- main
6-
pull_request:
7-
types: [closed]
6+
- 'v*.*.*'
87

98
jobs:
10-
build-and-publish-image:
9+
build-and-publish-image:
1110
runs-on: ubuntu-latest
1211
steps:
12+
1313
- name: Checkout
1414
uses: actions/checkout@v3
15+
16+
- name: Extract branch name
17+
shell: bash
18+
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
19+
id: branch_name
20+
1521
- name: Set up QEMU
1622
uses: docker/setup-qemu-action@v2
23+
1724
- name: Set up Docker Buildx
1825
uses: docker/setup-buildx-action@v2
26+
1927
- name: Login to Docker Hub
2028
uses: docker/login-action@v2
2129
with:
2230
username: ${{ secrets.DOCKER_USERNAME }}
2331
password: ${{ secrets.DOCKER_PASSWORD }}
32+
2433
- name: Build and push
2534
uses: docker/build-push-action@v4
2635
with:
2736
push: true
2837
platforms: linux/amd64
29-
tags: ${{ secrets.DOCKER_REPO }}/helm-client:latest
30-
- name: Update repo description
31-
uses: peter-evans/dockerhub-description@v3
32-
with:
33-
username: ${{ secrets.DOCKER_USERNAME }}
34-
password: ${{ secrets.DOCKER_PASSWORD }}
35-
repository: ${{ secrets.DOCKER_REPO }}/helm-client
38+
tags: ${{ secrets.DOCKER_REPO }}/helm-client:${{ steps.branch_name.outputs.branch }}

0 commit comments

Comments
 (0)