File tree Expand file tree Collapse file tree 2 files changed +17
-73
lines changed
Expand file tree Collapse file tree 2 files changed +17
-73
lines changed Original file line number Diff line number Diff line change 1- name : build
1+ ---
2+ name : Docker Build Action
23on :
4+ pull_request :
5+ branches :
6+ - main
7+ release :
8+ types :
9+ - published
310 push :
411 branches :
5- - " main"
6- tags :
7- - ' v*'
12+ - main
13+
814env :
915 REGISTRY : ghcr.io
1016 IMAGE_NAME : ${{ github.repository }}
1420 name : Build
1521 runs-on : ubuntu-latest
1622 steps :
17-
1823 - name : Set up Go 1.18
1924 uses : actions/setup-go@v2
2025 with :
@@ -36,21 +41,15 @@ jobs:
3641 username : ${{ github.actor }}
3742 password : ${{ secrets.GITHUB_TOKEN }}
3843
39- - name : Extract metadata (tags, labels) for Docker
40- id : meta
41- uses : docker/metadata-action@v3
42- with :
43- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44- tags : |
45- type=ref,event=branch
46- type=ref,event=pr
47- type=semver,pattern={{version}}
48- type=semver,pattern={{major}}.{{minor}}
44+ - name : Make tag
45+ run : |
46+ [ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo "tag=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV || true
47+ [ "${GITHUB_EVENT_NAME}" == 'release' ] && echo "tag=${GITHUB_REF##*/}" >> $GITHUB_ENV || true
48+ [ "${GITHUB_EVENT_NAME}" == 'push' ] && echo "tag=latest" >> $GITHUB_ENV || true
4949
50- - name : Build and push Docker image
50+ - name : Build and push image
5151 uses : docker/build-push-action@v2
5252 with :
5353 context : .
5454 push : true
55- tags : ${{ steps.meta.outputs.tags }}
56- labels : ${{ steps.meta.outputs.labels }}
55+ tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.tag }}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments