-
Notifications
You must be signed in to change notification settings - Fork 2
63 lines (54 loc) · 1.99 KB
/
publish-images.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
name: Publish Images
on:
push:
branches:
- main
- 'release-[0-9]+.[0-9]+'
# TODO: remove before merge
pull_request:
permissions:
contents: read
jobs:
test:
permissions:
contents: read # for actions/checkout to fetch code
packages: write # for publishing docker images
name: Build and Publish Images
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit
- name: Determine branch
id: determine
env:
BRANCH: ${{ github.ref }}
run: |
BRANCH=${BRANCH#refs/heads/} # strip off refs/heads/ if it exists
if [[ "${BRANCH}" == "main" ]]; then
echo "version=main" >> "$GITHUB_OUTPUT"
elif [[ "${BRANCH}" =~ ^release-[0-9]+\.[0-9]+$ ]]; then
echo "version=v${BRANCH#release-}" >> "$GITHUB_OUTPUT"
else
# TODO: Remove before merge, only for testing
echo "Use Branch ${BRANCH} only for testing."
echo "version=latest" >> "$GITHUB_OUTPUT"
# exit 1
fi
- name: Check out code
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build bootstrap provider image
run: make BOOTSTRAP_IMG_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap
- name: Build controlplane provider image
run: make CONTROLPLANE_IMG_TAG=${{ steps.determine.outputs.version }} docker-build-controlplane
- name: Publish bootstrap provider image
run: make BOOTSTRAP_IMG_TAG=${{ steps.determine.outputs.version }} docker-push-bootstrap
- name: Publish controlplane provider image
run: make CONTROLPLANE_IMG_TAG=${{ steps.determine.outputs.version }} docker-push-controlplane