-
Notifications
You must be signed in to change notification settings - Fork 5
94 lines (73 loc) · 2.83 KB
/
build-and-upload.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
name: Build and upload images
on:
schedule:
# First day of every month, you know, for automatic updates etc.
- cron: "0 0 1 * *"
push:
branches:
- main
env:
DOCKER_BUILDKIT: 1
jobs:
build_and_upload:
name: Build and upload
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Log in to the Container registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- name: Set up Python
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0
with:
python-version: "3.10"
- name: Install regctl
run: |
set -ex
INSTALL_DIR="$HOME/.regctl"
OS=linux
ARCH=amd64
mkdir -p "$INSTALL_DIR"
# Download and Install regctl
curl -fsSL "https://github.com/regclient/regclient/releases/download/${VERSION}/regctl-${OS}-${ARCH}" > "${INSTALL_DIR}/regctl"
chmod 755 "${INSTALL_DIR}/regctl"
# Validate download
if which cosign >/dev/null; then
curl -fsSL https://github.com/regclient/regclient/releases/latest/download/metadata.tgz > metadata.tgz
tar -xzf metadata.tgz regctl-${OS}-${ARCH}.pem regctl-${OS}-${ARCH}.sig
cosign verify-blob \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity-regexp https://github.com/regclient/regclient/.github/workflows/ \
--certificate regctl-${OS}-${ARCH}.pem \
--signature regctl-${OS}-${ARCH}.sig \
"${{ inputs.install-dir }}/regctl"
rm -rf metadata.tgz regctl-${OS}-${ARCH}.pem regctl-${OS}-${ARCH}.sig
fi
# Add it to environment
echo "${INSTALL_DIR}" >> $GITHUB_PATH
env:
VERSION: v0.4.7
- name: Check regctl installation
run: regctl version
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Setup custom builder
run: |
docker buildx create --use --bootstrap --name multi-builder --platform linux/arm64,linux/amd64 --driver-opt network=host
- name: Run local Docker registry
run: docker run -d -p 5000:5000 --name registry --network=host registry:2
- name: Install Poetry
run: pip install poetry
- name: Install dependencies
run: poetry install
- name: Build images
run: poetry run build_multiplatform --parallel 8
- name: Upload images
if: success()
run: |
poetry run upload