-
Notifications
You must be signed in to change notification settings - Fork 156
93 lines (89 loc) · 2.4 KB
/
build.yml
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
name: Build
# Run on push to main and any pull request.
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
pull-requests: read
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
app:
- pebble
- pebble-challtestsrv
go-arch:
- amd64
- arm64
go-os:
- darwin
- linux
- windows
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
check-latest: true
go-version-file: go.mod
- name: Build ${{ matrix.app }}
env:
APP: ${{ matrix.app }}
GOARCH: ${{ matrix.go-arch }}
GOOS: ${{ matrix.go-os }}
run: ./build-release.sh
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.go-os }}-${{ matrix.go-arch }}
path: dist
docker:
needs:
- build
runs-on: ubuntu-latest
strategy:
matrix:
app:
- pebble
- pebble-challtestsrv
docker-arch:
- amd64
- arm64
docker-os:
- linux
- windows
exclude:
- docker-arch: arm64
docker-os: windows
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: dist
pattern: dist-${{ matrix.docker-os }}-${{ matrix.docker-arch }}
- name: Display artifacts
run: ls -lR dist
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push ${{ github.repository }}/${{ matrix.app }} for ${{ matrix.docker-os }}/${{ matrix.docker-arch }}
uses: docker/build-push-action@v5
with:
build-args: APP=${{ matrix.app }}
build-contexts: dist-files=dist
cache-from: type=gha
cache-to: type=gha,mode=max
file: Dockerfile.release
platforms: ${{ matrix.docker-os }}/${{ matrix.docker-arch }}
push: true
tags: ghcr.io/${{ github.repository }}/${{ matrix.app }}:${{ github.sha }}