-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (137 loc) · 4.09 KB
/
build-publish.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
---
name: Build and publish container images
on:
release:
types:
- published
workflow_dispatch:
env:
REGISTRY: ghcr.io
jobs:
create-runners:
name: Create self-hosted Actions runner
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 4
matrix:
runner-name: [
actions-runner,
avahi,
certbot-cloudflare,
fullbogons,
growatt-ev,
iperf2,
iperf3,
irrd,
mdns-reflector,
rng-tools,
speedtest,
stun,
telegraf,
verlihub,
vyos-release-alert,
xteve,
yancobat
]
steps:
- name: Create self-hosted Actions runner
uses: MattKobayashi/[email protected]
with:
gh-app-id: ${{ secrets.GH_APP_ID }}
gh-app-login: MattKobayashi
gh-app-private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
runner-network: mattflix
ssh-host: 100.102.37.118
ssh-user: matthew
ts-oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
ts-oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
ts-tag: ci
build-setup:
name: Set up build environment
runs-on: ubuntu-latest
outputs:
repo-owner: ${{ steps.repo-lowercase.outputs.REPO_OWNER }}
steps:
- name: Convert repository owner name to lowercase
id: repo-lowercase
run: |
echo "REPO_OWNER=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_OUTPUT
build-publish:
name: Build and publish image
runs-on: self-hosted
needs: [create-runners, build-setup]
strategy:
fail-fast: false
max-parallel: 4
matrix:
container: [
actions-runner,
avahi,
certbot-cloudflare,
fullbogons,
growatt-ev,
iperf2,
iperf3,
irrd,
mdns-reflector,
rng-tools,
speedtest,
stun,
telegraf,
verlihub,
vyos-release-alert,
xteve,
yancobat
]
steps:
# Checkout repository
# https://github.com/actions/checkout
- name: Checkout repository
uses: actions/[email protected]
# Set up QEMU
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/[email protected]
# Set up Docker Buildx
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/[email protected]
with:
buildkitd-config-inline: |
[registry."docker.io"]
mirrors = ["registry-mirror:5000"]
[registry."registry-mirror:5000"]
http = true
driver-opts: |
network=mattflix
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ needs.build-setup.outputs.repo-owner }}/${{ matrix.container }}
tags: |
type=semver,pattern=v{{version}},event=tag
type=semver,pattern=v{{major}}.{{minor}},event=tag
type=semver,pattern=v{{major}},event=tag
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: ${{ github.workspace }}/${{ matrix.container }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max