File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
22# Ignore build and test binaries.
3- bin /
3+ ! api /
4+ ! cmd /
5+ ! examples /
6+ ! internal /
7+ ! go.mod
8+ ! go.sum
Original file line number Diff line number Diff line change 1+ name : Build
2+
3+ on :
4+ push :
5+
6+ env :
7+ IMG_REGISTRY : ghcr.io/slyngdk/
8+ IMG_NAME_CONTROLLER : nodedrain
9+
10+ jobs :
11+ build :
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Checkout code
15+ uses : actions/checkout@v2
16+
17+ - name : Setup Go
18+ uses : actions/setup-go@v5
19+ with :
20+ go-version-file : go.mod
21+
22+ - name : Login to GitHub Container Registry
23+ if : github.ref == 'refs/heads/main' || github.ref_type == 'tag'
24+ uses : docker/login-action@v3
25+ with :
26+ registry : ghcr.io
27+ username : ${{ github.actor }}
28+ password : ${{ secrets.GITHUB_TOKEN }}
29+
30+ - name : Build image
31+ id : build_image
32+ run : |
33+ export IMG_TAG=ci-${{ github.ref_name }}
34+ if [[ "${{ github.ref_type }}" == "branch" && "${{ github.ref_name }}" == "main" ]]; then
35+ export IMG_TAG=latest
36+ elif [[ "${{ github.ref_type }}" == "tag" && "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
37+ export IMG_TAG=$(echo -n "${{ github.ref_name }}" | sed 's/^v//g')
38+ fi
39+ echo "IMG_TAG=${IMG_TAG}" >> $GITHUB_OUTPUT
40+ make docker-build
41+
42+ - name : Push image
43+ if : github.ref == 'refs/heads/main' || github.ref_type == 'tag'
44+ env :
45+ IMG_TAG : ${{ steps.build_image.outputs.IMG_TAG }}
46+ run : |
47+ if [[ "${{ github.ref_type }}" == "tag" && "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit 0
48+ make docker-push
You can’t perform that action at this time.
0 commit comments