Skip to content

Release hgctl to GitHub #13

Release hgctl to GitHub

Release hgctl to GitHub #13

name: Release hgctl to GitHub
on:
push:
tags:
- "v*.*.*"
workflow_dispatch: ~
jobs:
release-hgctl:
runs-on: ubuntu-latest
env:
HGCTL_VERSION: ${{github.ref_name}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.21.5
- name: Build hgctl latest multiarch binaries
run: |
GOPROXY="https://proxy.golang.org,direct" make build-hgctl-multiarch
tar -zcvf hgctl_${{ env.HGCTL_VERSION }}_linux_amd64.tar.gz out/linux_amd64/
tar -zcvf hgctl_${{ env.HGCTL_VERSION }}_linux_arm64.tar.gz out/linux_arm64/
zip -q -r hgctl_${{ env.HGCTL_VERSION }}_windows_amd64.zip out/windows_amd64/
zip -q -r hgctl_${{ env.HGCTL_VERSION }}_windows_arm64.zip out/windows_arm64/
- name: Upload hgctl packages to the GitHub release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
hgctl_${{ env.HGCTL_VERSION }}_linux_amd64.tar.gz
hgctl_${{ env.HGCTL_VERSION }}_linux_arm64.tar.gz
hgctl_${{ env.HGCTL_VERSION }}_windows_amd64.zip
hgctl_${{ env.HGCTL_VERSION }}_windows_arm64.zip
# release-hgctl-macos-arm64:
# runs-on: macos-latest
# env:
# HGCTL_VERSION: ${{github.ref_name}}
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-go@v5
# with:
# go-version: 1.21.5
# - name: Build hgctl latest macos binaries
# run: |
# GOPROXY="https://proxy.golang.org,direct" make build-hgctl-macos-arm64
# tar -zcvf hgctl_${{ env.HGCTL_VERSION }}_darwin_arm64.tar.gz out/darwin_arm64/
# - name: Upload hgctl packages to the GitHub release
# uses: softprops/action-gh-release@v2
# if: startsWith(github.ref, 'refs/tags/')
# with:
# files: |
# hgctl_${{ env.HGCTL_VERSION }}_darwin_arm64.tar.gz
release-hgctl-macos:
runs-on: macos-12
env:
HGCTL_VERSION: ${{github.ref_name}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.21.5
- name: Ensure Xcode Command Line Tools Path
run: sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
- name: Install necessary libraries
run: |
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a /usr/local/lib/libarclite_macosx.a
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a /usr/local/lib/libarclite_iphoneos.a
- name: Set environment variables
run: |
echo "PATH=/usr/local/opt/llvm/bin:$PATH" >> $GITHUB_ENV
echo "LDFLAGS=-L/usr/local/opt/llvm/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I/usr/local/opt/llvm/include" >> $GITHUB_ENV
echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> $GITHUB_ENV
- name: Build hgctl latest macos binaries
run: |
cd ./hgctl
mkdir -p ./out/darwin_amd64/
go build -o ./out/darwin_amd64/ ./cmd/hgctl
tar -zcvf hgctl_${{ env.HGCTL_VERSION }}_darwin_amd64.tar.gz out/darwin_amd64/
tar -zcvf hgctl_${{ env.HGCTL_VERSION }}_darwin_arm64.tar.gz out/darwin_arm64/
- name: Upload hgctl packages to the GitHub release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
hgctl_${{ env.HGCTL_VERSION }}_darwin_amd64.tar.gz
hgctl_${{ env.HGCTL_VERSION }}_darwin_arm64.tar.gz