-
Notifications
You must be signed in to change notification settings - Fork 45
114 lines (96 loc) · 2.91 KB
/
go.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Go
on: [push, pull_request]
env:
GO_VERSION: "1.21"
GHCR_REGISTRY: ghcr.io
GHCR_REGISTRY_IMAGE: "ghcr.io/${{ github.repository }}"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Install dependencies
run: |
go install golang.org/x/tools/cmd/goimports@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
export PATH="$HOME/go/bin:$PATH"
- name: Run pre-commit
uses: pre-commit/[email protected]
build:
runs-on: ubuntu-latest
env:
CGO_ENABLED: "0"
steps:
- uses: actions/checkout@v3
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Build binaries
run: ./ci-build-all.sh
- name: Upload linux/amd64 artifact
uses: actions/upload-artifact@v3
with:
name: bbctl-linux-amd64
path: bbctl-linux-amd64
if-no-files-found: error
- name: Upload linux/arm64 artifact
uses: actions/upload-artifact@v3
with:
name: bbctl-linux-arm64
path: bbctl-linux-arm64
if-no-files-found: error
- name: Upload macos/amd64 artifact
uses: actions/upload-artifact@v3
with:
name: bbctl-macos-amd64
path: bbctl-macos-amd64
if-no-files-found: error
- name: Upload macos/arm64 artifact
uses: actions/upload-artifact@v3
with:
name: bbctl-macos-arm64
path: bbctl-macos-arm64
if-no-files-found: error
build-docker:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to registry
uses: docker/login-action@v2
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Build
uses: docker/build-push-action@v4
with:
cache-from: ${{ env.GHCR_REGISTRY_IMAGE }}:latest
pull: true
file: docker/Dockerfile
tags: ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}
push: true
build-args: |
COMMIT_HASH=${{ github.sha }}
deploy-docker:
runs-on: ubuntu-latest
needs:
- build-docker
if: github.ref == 'refs/heads/main'
steps:
- name: Login to registry
uses: docker/login-action@v2
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: beeper/docker-retag-push-latest@main
with:
image: ${{ env.GHCR_REGISTRY_IMAGE }}