Skip to content

Commit

Permalink
.github/workflows: Update make release
Browse files Browse the repository at this point in the history
Signed-off-by: Kfir Toledo <[email protected]>
  • Loading branch information
kfirtoledo committed Feb 29, 2024
1 parent e51184e commit 7f4bae6
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 26 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/make-release.yml

This file was deleted.

60 changes: 60 additions & 0 deletions .github/workflows/release.yml
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 }}
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ push-image: docker-build
docker push $(IMAGE_BASE)/cl-go-dataplane:$(IMAGE_VERSION)
docker tag gwctl:latest $(IMAGE_BASE)/gwctl:$(IMAGE_VERSION)
docker push $(IMAGE_BASE)/gwctl:$(IMAGE_VERSION)
docker tag cl-operator:latest $(IMAGE_BASE)/cl-operator:$(IMAGE_VERSION)
docker push $(IMAGE_BASE)/cl-operator:$(IMAGE_VERSION)

install:
cp ./bin/gwctl /usr/local/bin/
Expand Down
61 changes: 61 additions & 0 deletions hack/clusterlink.sh
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"

0 comments on commit 7f4bae6

Please sign in to comment.