-
Notifications
You must be signed in to change notification settings - Fork 3
81 lines (72 loc) · 2.77 KB
/
release-k0s-patch.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
name: Build and Release K0s Patch
on:
workflow_dispatch:
inputs:
tag:
description: "Upstream tag to be used as a base, patches will be applied on top of this tag, e.g. v1.30.0+k0s.0."
required: true
patchDir:
description: "The directory (in this repository) to read the patches from, e.g. 'k0s-patches/release-1.30'."
required: true
default: 'k0s-patches/release-1.30'
versionSuffix:
description: "The custom suffix for the compiled k0s version, e.g. ec.1."
required: true
default: 'ec.0'
jobs:
build-and-release:
strategy:
fail-fast: false
matrix:
runner: [
{name: ubuntu-latest, arch: amd64},
{name: ec-ubuntu-24.04-arm64, arch: arm64},
]
runs-on: ${{ matrix.runner.name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout Upstream
uses: actions/checkout@v4
with:
repository: k0sproject/k0s
ref: refs/tags/${{ github.event.inputs.tag }}
persist-credentials: false
path: k0s
- name: Setup Git Config
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
cd k0s && git fetch
- name: Apply Patches
run: |
cd k0s && git am -3 < ../${{ github.event.inputs.patchDir }}/*.patch
- name: Tag Embedded Cluster Release
run: |
cd k0s && git tag ${{ github.event.inputs.tag }}-${{ github.event.inputs.versionSuffix }}
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: k0s/go.mod
cache-dependency-path: k0s/go.sum
- name: Build k0s
run: |
make -C k0s bindata
make -C k0s --touch codegen
make -C k0s build
- name: Upload build
env:
S3_BUCKET: tf-staging-embedded-cluster-bin
AWS_ACCESS_KEY_ID: ${{ secrets.STAGING_EMBEDDED_CLUSTER_UPLOAD_IAM_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.STAGING_EMBEDDED_CLUSTER_UPLOAD_IAM_SECRET }}
AWS_REGION: us-east-1
run: |
object_key="custom-k0s-binaries/k0s-${{ github.event.inputs.tag }}-${{ github.event.inputs.versionSuffix }}-${{ matrix.runner.arch }}"
# check if the file already exists
if aws s3api head-object --bucket="${S3_BUCKET}" --key="${object_key}" > /dev/null 2>&1; then
echo "::notice ::Binary already exists in https://${S3_BUCKET}.s3.amazonaws.com/${object_key}"
exit 1
fi
# upload the file
aws s3 cp "k0s/k0s" "s3://${S3_BUCKET}/${object_key}"
echo "::notice ::Binary uploaded to https://${S3_BUCKET}.s3.amazonaws.com/${object_key}"