-
Notifications
You must be signed in to change notification settings - Fork 18
60 lines (58 loc) · 2.01 KB
/
release.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
name: Release Images and Binaries
on:
push:
tags:
- 'v**'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build binaries for amd64
run: GOARCH=amd64 make build
- name: Build binaries for arm64
run: GOARCH=arm64 make build
- name: Tag and push ClusterLink images with tag 'latest' and ${{ github.ref_name }}
run: |
docker buildx create --use --driver docker-container
PLATFORMS=linux/amd64,linux/arm64 make push-image
PLATFORMS=linux/amd64,linux/arm64 make push-image IMAGE_VERSION=${{ github.ref_name }}
- name: Build and compress binaries
run: |
for pair in "linux:amd64" "linux:arm64" "darwin:amd64" "darwin:arm64"; do
IFS=':' read -r os arch <<< "$pair"
GOOS="$os" GOARCH="$arch" CGO_ENABLED=0 make cli-build BIN_DIR="$os"
tar -czvf "clusterlink-$os-$arch.tar.gz" --transform "s/$os/clusterlink/" ./"$os"
done
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./clusterlink*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Update script installation version
run: sed -i "s/VERSION=\"latest\"/VERSION=\"${{ github.ref_name }}\"/" hack/install_clusterlink.sh
- name: Upload script installation
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./hack/install_clusterlink.sh
asset_name: clusterlink.sh
tag: ${{ github.ref }}
overwrite: true