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 release action
Signed-off-by: Kfir Toledo <[email protected]>
- Loading branch information
1 parent
49a3aa8
commit db1f68f
Showing
5 changed files
with
150 additions
and
48 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,57 @@ | ||
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 make cli-build BIN_DIR=linux | ||
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 make cli-build BIN_DIR=os | ||
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 make cli-build BIN_DIR=osarm64 | ||
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,77 @@ | ||
#!/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 | ||
|
||
# Open the tar file. | ||
curl -fsLO ${url} | ||
tar -xzf "${filename}" | ||
rm "${filename}" | ||
|
||
current_path=$(pwd)/clusterlink | ||
|
||
install_path=${HOME}/.local/bin | ||
mv $current_path/* $install_path | ||
rm -rf $current_path | ||
|
||
# Installation summary. | ||
printf "\n" | ||
printf "\e[1;34m.----. .----. .-. . .-..-. .-..-. .----. .--. .----. .---. .----. .-. .-..----. .-. .----..---. .----.\n" | ||
printf "| {} \\/ {} \| |/ \| || \`| || | / {} \\ / {} \\ | {} \ / ___}/ {} \| \`.' || {} }| | | {_ {_ _}| {_ \n" | ||
printf "| /\\ /| .'. || |\ || \`--.\ // /\\ \| / \\ }\ /| |\ /| || .--' | \`--.| {__ | | | {__ \n" | ||
printf "\`----' \`----' \`-' \`-'\`-' \`-'\`----' \`----' \`-' \`-'\`----' \`---' \`----' \`-' \` \`-'\`-' \`----'\`----' \`-' \`----'\e[0m\n" | ||
printf "\n\n" | ||
|
||
printf "%s has been successfully downloaded.\n" "$filename" | ||
printf "\n" | ||
printf "ClusterLink CLI (gwctl and cl-adm) added to your environment path:\n" | ||
printf "\n" | ||
printf "\t\e[1;33m%s\n\e[0m" "$install_path" | ||
printf "\n" | ||
printf "If the ClusterLink command is not in your path, please add it using the following command:\n" | ||
printf "\n" | ||
printf "\t\e[1;33mexport PATH=\"\$PATH:%s\"\n\e[0m" "$install_path" | ||
printf "\n" | ||
printf "For more information on how to set up ClusterLink in your Kubernetes cluster, please see: \e[4mhttps://cluster-link.net/docs/getting-started\e[0m\n" | ||
printf "\n" |
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