22
33on :
44 push :
5- branches : [ main ]
5+ branches : [main]
6+ tags : ["v*.*.*"]
67 pull_request :
78 types : [opened, reopened, synchronize]
89
@@ -15,19 +16,59 @@ jobs:
1516 platform : [ubuntu-latest, macos-latest, windows-latest]
1617 runs-on : ${{ matrix.platform }}
1718 steps :
18- - uses : actions/checkout@v2
19+ - uses : actions/checkout@v2
1920
20- - name : setup go
21- uses : actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
22- with :
23- go-version : ${{ matrix.go-version }}
21+ - name : setup go
22+ uses : actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
23+ with :
24+ go-version : ${{ matrix.go-version }}
2425
25- - name : Build
26- run : go build -v ./...
26+ - name : Build
27+ run : go build -v ./...
2728
28- - name : Test
29- run : go test -v ./...
29+ - name : Test
30+ run : go test -v ./...
3031
31- - name : Format
32- if : matrix.platform == 'ubuntu-latest'
33- run : if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
32+ - name : Format
33+ if : matrix.platform == 'ubuntu-latest'
34+ run : if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
35+ docker-build-push :
36+ if : github.event_name != 'pull_request'
37+ needs : build-test
38+ runs-on : ubuntu-latest
39+ permissions :
40+ contents : read
41+ packages : write
42+ steps :
43+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
44+ with :
45+ fetch-depth : 0
46+
47+ - uses : docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
48+ with :
49+ registry : ghcr.io
50+ username : ${{ github.actor }}
51+ password : ${{ secrets.GITHUB_TOKEN }}
52+
53+ - uses : docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
54+
55+ - uses : docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
56+ id : meta
57+ with :
58+ images : |
59+ ghcr.io/${{ github.repository }}
60+ tags : |
61+ type=ref,event=branch
62+ type=semver,pattern={{version}}
63+ type=semver,pattern={{major}}.{{minor}}
64+ type=semver,pattern={{major}}
65+ type=sha
66+
67+ - uses : docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6.16.0
68+ with :
69+ context : .
70+ push : true
71+ file : Dockerfile.buildx
72+ platforms : linux/amd64,linux/arm64,linux/arm
73+ tags : ${{ steps.meta.outputs.tags }}
74+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments