File tree Expand file tree Collapse file tree 1 file changed +29
-7
lines changed
Expand file tree Collapse file tree 1 file changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -3,20 +3,34 @@ name: Build and Push Docker Image for Helm Client
33on :
44 push :
55 branches :
6+ - main
67 - ' v*.*.*'
8+ pull_request :
9+ types : [closed]
710
811jobs :
9- build-and-publish-image :
12+ build-and-publish-image :
1013 runs-on : ubuntu-latest
11- steps :
1214
15+ steps :
1316 - name : Checkout
1417 uses : actions/checkout@v3
15-
18+
1619 - name : Extract branch name
17- shell : bash
18- run : echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
1920 id : branch_name
21+ shell : bash
22+ run : |
23+ echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
24+
25+ - name : Set Docker tag
26+ id : docker_tag
27+ shell : bash
28+ run : |
29+ if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
30+ echo "tag=latest" >> $GITHUB_OUTPUT
31+ elif [[ "${{ github.ref }}" == refs/heads/v* ]]; then
32+ echo "tag=${{ steps.branch_name.outputs.branch }}" >> $GITHUB_OUTPUT
33+ fi
2034
2135 - name : Set up QEMU
2236 uses : docker/setup-qemu-action@v2
3044 username : ${{ secrets.DOCKER_USERNAME }}
3145 password : ${{ secrets.DOCKER_PASSWORD }}
3246
33- - name : Build and push
47+ - name : Build and push Docker image
3448 uses : docker/build-push-action@v4
3549 with :
3650 push : true
3751 platforms : linux/amd64
38- tags : ${{ secrets.DOCKER_REPO }}/helm-client:${{ steps.branch_name.outputs.branch }}
52+ tags : ${{ secrets.DOCKER_REPO }}/helm-client:${{ steps.docker_tag.outputs.tag }}
53+
54+ - name : Update Docker Hub description
55+ if : github.ref == 'refs/heads/main'
56+ uses : peter-evans/dockerhub-description@v3
57+ with :
58+ username : ${{ secrets.DOCKER_USERNAME }}
59+ password : ${{ secrets.DOCKER_PASSWORD }}
60+ repository : ${{ secrets.DOCKER_REPO }}/helm-client
You can’t perform that action at this time.
0 commit comments