forked from clusterlink-net/clusterlink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.github/workflows: Update make release
Signed-off-by: Kfir Toledo <[email protected]>
- Loading branch information
1 parent
e51184e
commit 7f4bae6
Showing
4 changed files
with
123 additions
and
26 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Release Images and Binaries | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v**' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
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 images | ||
run: make docker-build | ||
- name: Build and compress linux binaries | ||
run: | | ||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ./linux/gwctl ./cmd/gwctl | ||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ./linux/cl-adm ./cmd/cl-adm | ||
tar -czvf clusterlink-linux-amd64.tar.gz --transform 's/linux/clusterlink/' ./linux | ||
- name: Build and compress macOS binaries | ||
run: | | ||
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o ./os/gwctl ./cmd/gwctl | ||
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o ./os/cl-adm ./cmd/cl-adm | ||
tar -czvf clusterlink-darwin-amd64.tar.gz --transform 's/os/clusterlink/' ./os | ||
- name: Build and compress Arm-based macOS binaries | ||
run: | | ||
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o ./osarm64/gwctl ./cmd/gwctl | ||
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o ./osarm64/cl-adm ./cmd/cl-adm | ||
tar -czvf clusterlink-darwin-arm64.tar.gz --transform 's/osarm64/clusterlink/' ./osarm64 | ||
- 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: Upload script | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: ./hack/clusterlink.sh | ||
asset_name: clusterlink.sh | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
# - name: Tag and push ClusterLink images with tag 'latest' | ||
# run: make push-image | ||
# - name: Tag and push ClusterLink images latest with tag ${{ github.ref_name }} | ||
# run: make push-image IMAGE_VERSION=${{ github.ref_name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# Detrmine the OS. | ||
OS=$(uname) | ||
if [ "${OS}" = "Darwin" ] ; then | ||
CL_OS="os" | ||
else | ||
CL_OS="linux" | ||
fi | ||
|
||
|
||
# Detrmine the OS architecture. | ||
OS_ARCH=$(uname -m) | ||
case "${OS_ARCH}" in | ||
x86_64|amd64) | ||
CL_ARCH=amd64 | ||
;; | ||
armv8*|aarch64*|arm64) | ||
ARCH=arm64 | ||
;; | ||
*) | ||
echo "This ${OS_ARCH} architecture isn't supported" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
filename="clusterlink-${CL_OS}-${CL_ARCH}.tar.gz" | ||
url="https://github.com/kfirtoledo/clusterlink/releases/download/${VERSION}/${filename}" | ||
|
||
# Set version to latest if not define and update url. | ||
if [ "${VERSION}" = "" ] ; then | ||
VERSION="latest" | ||
url="https://github.com/kfirtoledo/clusterlink/releases/${VERSION}/download/${filename}" | ||
fi | ||
|
||
|
||
|
||
#url="https://github.com/clusterlinl-net/releases/download/${VERSION}/" +filename | ||
printf "\n Downloading %s from %s ...\n" "$filename" "$url" | ||
|
||
if ! curl -o /dev/null -sIf "$url"; then | ||
printf "\n%s This version of clusterlonk wasn't found\n" "$url" | ||
exit 1 | ||
fi | ||
|
||
curl -fsLO ${url} | ||
|
||
tar -xzf "${filename}" | ||
rm "${filename}" | ||
|
||
path=$(pwd)/clusterlink | ||
printf "\n" | ||
printf "%s has been successfully downloaded into 'clusterlink' folder.\n" "$filename" | ||
printf "\n" | ||
printf "To add ClusterLink CLI to your environment path, use the following command:\n" | ||
printf "\t export PATH=\"\$PATH:%s\"\n" "$path" | ||
printf "\n" | ||
printf "For more information on how to set up ClusterLink in your Kubernetes cluster, please see: https://cluster-link.net/docs/getting-started \n" | ||
printf "\n" | ||
|