-
Notifications
You must be signed in to change notification settings - Fork 2
69 lines (59 loc) · 2.34 KB
/
release.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
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+'
pull_request:
jobs:
release:
permissions:
contents: read # for actions/checkout to fetch code
packages: write # for publishing docker images
name: Release
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit
- name: Retrieve build information
id: build
run: |
VERSION=v0.0.1-rcX #"${GITHUB_REF#refs/tags/}"
echo "Releasing ${VERSION}"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- 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 -qp |
awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}' |
sort -u
make BOOTSTRAP_IMG_TAG=${{ env.VERSION }} docker-build-bootstrap
- name: Build controlplane provider image
run: make CONTROLPLANE_IMG_TAG=${{ env.VERSION }} docker-build-controlplane
- name: Publish bootstrap provider image
run: make BOOTSTRAP_IMG_TAG=${{ env.VERSION }} docker-push-bootstrap
- name: Publish controlplane provider image
run: make CONTROLPLANE_IMG_TAG=${{ env.VERSION }} docker-push-controlplane
- name: Build manifests
run: |
make release
sed -i "s,ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:latest,ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:${VERSION//v}," out/bootstrap-components.yaml
sed -i "s,ghcr.io/canonical/cluster-api-k8s/controlplane-controller:latest,ghcr.io/canonical/cluster-api-k8s/controlplane-controller:${VERSION//v}," out/control-plane-components.yaml
- name: Create GitHub Release
uses: softprops/[email protected]
with:
name: 'Release ${{ env.VERSION }}'
files: |
out/bootstrap-components.yaml
out/control-plane-components.yaml
out/metadata.yaml
generate_release_notes: true
draft: false
prerelease: ${{ contains(env.VERSION, 'rc') }}