diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40e5d52..a701444 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,9 +9,9 @@ jobs: env: TOKEN: ${{ secrets.RIDECELL_PUBLIC_REPO_TOKEN }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Setup go - uses: actions/setup-go@v5 + uses: actions/setup-go@v7 with: go-version-file: go.mod - name: Setup gitconfig fot private go module @@ -30,16 +30,16 @@ jobs: env: TOKEN: ${{ secrets.RIDECELL_PUBLIC_REPO_TOKEN }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Setup go - uses: actions/setup-go@v5 + uses: actions/setup-go@v7 with: go-version-file: go.mod - name: Setup gitconfig for private go modules run: | git config --global url."https://${TOKEN}:x-oauth-basic@github.com/Ridecell".insteadOf "https://github.com/Ridecell" - + - name: build run: | make build_macos build_linux @@ -52,3 +52,33 @@ jobs: mv bin/ridectl.linux bin/ridectl && zip -jrm bin/ridectl_linux.zip bin/ridectl go install github.com/tcnksm/ghr@latest ghr -c ${{ github.sha }} ${{ github.ref_name }} bin/ + + build-linux-arm64: + name: Build Linux arm64 + runs-on: ubuntu-24.04-arm + needs: lint + env: + TOKEN: ${{ secrets.RIDECELL_PUBLIC_REPO_TOKEN }} + steps: + - uses: actions/checkout@v7 + - name: Setup go + uses: actions/setup-go@v7 + with: + go-version-file: go.mod + + - name: Setup gitconfig for private go modules + run: | + git config --global url."https://${TOKEN}:x-oauth-basic@github.com/Ridecell".insteadOf "https://github.com/Ridecell" + + - name: build + run: | + make build_linux_arm64 + + - name: Release + if: startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + mv bin/ridectl.linux.arm64 bin/ridectl && zip -jrm bin/ridectl_linux_arm64.zip bin/ridectl + go install github.com/tcnksm/ghr@latest + ghr -c ${{ github.sha }} ${{ github.ref_name }} bin/ diff --git a/Makefile b/Makefile index d1232df..4257542 100644 --- a/Makefile +++ b/Makefile @@ -21,3 +21,7 @@ build_macos: # Build command binary, for Linux build_linux: ./build_ridectl.sh linux $(TSH_VERSION) + +# Build command binary, for Linux arm64 +build_linux_arm64: + ./build_ridectl.sh linux_arm64 $(TSH_VERSION) diff --git a/build_ridectl.sh b/build_ridectl.sh index d487415..e31d8b8 100755 --- a/build_ridectl.sh +++ b/build_ridectl.sh @@ -36,6 +36,12 @@ then tar -xf teleport-v$TSH_VERSION-linux-amd64-bin.tar.gz cp teleport/tsh pkg/exec/bin/ GOOS=linux GOARCH=amd64 go build -o bin/ridectl.linux -ldflags "-X github.com/Ridecell/ridectl/pkg/exec.tshMD5=$(md5sum teleport/tsh | awk '{ print $1 }'| tr -d '\n') -X github.com/Ridecell/ridectl/pkg/cmd.version=$(git describe --tags)" -tags release github.com/Ridecell/ridectl/cmd/ridectl +elif [[ "$OS" == "linux_arm64" ]] +then + wget https://get.gravitational.com/teleport-v$TSH_VERSION-linux-arm64-bin.tar.gz + tar -xf teleport-v$TSH_VERSION-linux-arm64-bin.tar.gz + cp teleport/tsh pkg/exec/bin/ + GOOS=linux GOARCH=arm64 go build -o bin/ridectl.linux.arm64 -ldflags "-X github.com/Ridecell/ridectl/pkg/exec.tshMD5=$(md5sum teleport/tsh | awk '{ print $1 }'| tr -d '\n') -X github.com/Ridecell/ridectl/pkg/cmd.version=$(git describe --tags)" -tags release github.com/Ridecell/ridectl/cmd/ridectl else echo "Invalid OS value: $OS, exiting." exit 1