1
- name : CI
2
- on :
3
- pull_request : {}
4
- push : {}
5
- permissions : write-all
6
- jobs :
7
- # ================
8
- # BUILD AND TEST JOB
9
- # ================
10
- test :
11
- name : Build & Test
12
- strategy :
13
- matrix :
14
- # optionally test/build across multiple platforms/Go-versions
15
- go-version : ["stable"] # '1.16', '1.17', '1.18,
16
- platform : [ubuntu-latest, macos-latest, windows-latest]
17
- runs-on : ${{ matrix.platform }}
18
- steps :
19
- - name : Checkout
20
- uses : actions/checkout@v3
21
- with :
22
- fetch-depth : 0
23
- - name : Set up Go
24
- uses : actions/setup-go@v3
25
- with :
26
- go-version : ${{ matrix.go-version }}
27
- check-latest : true
28
- - name : Build
29
- run : go build -v -o /dev/null .
30
- - name : Test
31
- run : go test -v ./...
32
- # ================
33
- # RELEASE BINARIES (on push "v*" tag)
34
- # ================
35
- release_binaries :
36
- name : Release Binaries
37
- needs : test
38
- if : startsWith(github.ref, 'refs/tags/v')
39
- runs-on : ubuntu-latest
40
- steps :
41
- - name : Check out code
42
- uses : actions/checkout@v3
43
- - name : goreleaser
44
- if : success()
45
- uses : docker://goreleaser/goreleaser:latest
46
- env :
47
- GITHUB_USER : ${{ github.repository_owner }}
48
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
49
- with :
50
- args : release --config .github/goreleaser.yml
51
- # ================
52
- # RELEASE DOCKER IMAGES (on push "v*" tag)
53
- # ================
54
- release_docker :
55
- name : Release Docker Images
56
- needs : test
57
- if : startsWith(github.ref, 'refs/tags/v')
58
- runs-on : ubuntu-latest
59
- steps :
60
- - name : Check out code
61
- uses : actions/checkout@v3
62
- - name : Set up QEMU
63
- uses : docker/setup-qemu-action@v2
64
- - name : Set up Docker Buildx
65
- uses : docker/setup-buildx-action@v2
66
- - name : Login to DockerHub
67
- uses : docker/login-action@v2
68
- with :
69
- username : jpillora
70
- password : ${{ secrets.DOCKERHUB_TOKEN }}
71
- - name : Docker meta
72
- id : meta
73
- uses : docker/metadata-action@v4
74
- with :
75
- images : jpillora/chisel
76
- tags : |
77
- type=semver,pattern={{version}}
78
- type=semver,pattern={{major}}.{{minor}}
79
- type=semver,pattern={{major}}
80
- - name : Build and push
81
- uses : docker/build-push-action@v3
82
- with :
83
- context : .
84
- file : .github/Dockerfile
85
- platforms : linux/amd64,linux/arm64,linux/ppc64le,linux/386,linux/arm/v7,linux/arm/v6
86
- push : true
87
- tags : ${{ steps.meta.outputs.tags }}
88
- labels : ${{ steps.meta.outputs.labels }}
89
- cache-from : type=gha
90
- cache-to : type=gha,mode=max
0 commit comments