-
Notifications
You must be signed in to change notification settings - Fork 180
83 lines (75 loc) · 2.55 KB
/
main.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
name: CI
on:
push:
branches: [ main, master ]
tags:
- v*
pull_request:
branches: [ main, master ]
workflow_dispatch:
jobs:
build:
permissions:
contents: write
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
# local build
- name: Compile the binary
run: |
make bin/goldpinger
./bin/goldpinger -h
# simple Docker build
- name: Build the Docker image
run: |
make build
docker run `make version` --help
- name: Login to DockerHub
uses: docker/login-action@v3
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# multi-arch build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
bake-target: docker-metadata-action
images: |
${{ github.repository_owner }}/goldpinger
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
labels: |
org.opencontainers.image.title=${{ github.repository }}
org.opencontainers.image.description=Goldpinger makes calls between its instances to monitor your networking. It runs as a DaemonSet on Kubernetes and produces Prometheus metrics that can be scraped, visualised and alerted on.
org.opencontainers.image.vendor=${{ github.repository_owner }}
- name: Build regular image
uses: docker/bake-action@v4
with:
targets: ci
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
# https://github.com/docker/buildx/issues/2105
- name: Create manifest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: |
set -xe
for image in $images; do
docker buildx imagetools create -t "${image}" "${image}-linux" "${image}-windows-ltsc2019" "${image}-windows-ltsc2022"
done
env:
images: "${{ join( steps.meta.outputs.tags, ' ') }}"