File tree Expand file tree Collapse file tree 3 files changed +49
-67
lines changed
Expand file tree Collapse file tree 3 files changed +49
-67
lines changed Original file line number Diff line number Diff line change 1+ name : Docker Image from master
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - master
7+ release :
8+ types :
9+ - published
10+ push :
11+ branches :
12+ - master
13+
14+ env :
15+ REGISTRY : ghcr.io
16+ IMAGE_NAME : ${{ github.repository }}
17+
18+ jobs :
19+ build :
20+ runs-on : ubuntu-latest
21+ steps :
22+ - name : Checkout code
23+ uses : actions/checkout@v4
24+ - name : Fetch tags # fetch-tags does not work
25+ run : git fetch --prune --unshallow --tags
26+
27+ - name : Make tag
28+ run : |
29+ [ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo "TAG_NAME=$(echo $GITHUB_REF | awk -F / '{print $3}')-${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV || true
30+ [ "${GITHUB_EVENT_NAME}" == 'release' ] && echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV || true
31+ [ "${GITHUB_EVENT_NAME}" == 'push' ] && echo "TAG_NAME=latest" >> $GITHUB_ENV || true
32+
33+ - name : Docker Login
34+ uses : docker/login-action@v3
35+ with :
36+ registry : ${{ env.REGISTRY }}
37+ username : ${{ secrets.DOCKER_REGISTRY_USER }}
38+ password : ${{ secrets.DOCKER_REGISTRY_TOKEN }}
39+
40+ - name : Set up Docker Buildx
41+ uses : docker/setup-buildx-action@v3
42+
43+ - name : Build and push image
44+ uses : docker/build-push-action@v6
45+ with :
46+ context : .
47+ push : true
48+ sbom : true
49+ tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }}
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments