1.0.10 #53
Workflow file for this run
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
name: build | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
if: "!github.event.release.prerelease" | |
name: Building ${{ matrix.arch }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
arch: linux-amd64 | |
zssh_artifact_name: zssh | |
zssh_asset_name: zssh-linux-amd64 | |
zscp_artifact_name: zscp | |
zscp_asset_name: zscp-linux-amd64 | |
- os: windows-latest | |
arch: windows-amd64 | |
zssh_artifact_name: zssh.exe | |
zssh_asset_name: zssh-windows-amd64.exe | |
zscp_artifact_name: zscp.exe | |
zscp_asset_name: zscp-windows-amd64.exe | |
- os: macos-latest | |
arch: macos-amd64 | |
zssh_artifact_name: zssh | |
zssh_asset_name: zssh-macos-amd64 | |
zscp_artifact_name: zscp | |
zscp_asset_name: zscp-macos-amd64 | |
- os: macos-latest | |
arch: macos-arm64 | |
zssh_artifact_name: zssh | |
zssh_asset_name: zssh-macos-arm64 | |
zscp_artifact_name: zscp | |
zscp_asset_name: zscp-macos-arm64 | |
- os: ubuntu-latest | |
arch: linux-arm | |
go_opts: CC=arm-linux-gnueabi-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm | |
zssh_artifact_name: zssh | |
zssh_asset_name: zssh-linux-arm | |
zscp_artifact_name: zscp | |
zscp_asset_name: zscp-linux-arm | |
- os: ubuntu-latest | |
arch: linux-arm64 | |
go_opts: CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc GOOS=linux GOARCH=arm64 | |
zssh_artifact_name: zssh | |
zssh_asset_name: zssh-linux-arm64 | |
zscp_artifact_name: zscp | |
zscp_asset_name: zscp-linux-arm64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22 | |
# Get the Git commit hash and build date | |
- name: Get Git commit hash | |
id: vars | |
run: | | |
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
echo "BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_ENV | |
# Get the latest Git tag for versioning | |
- name: Get Git tag | |
run: echo "VERSION=$(git describe --tags --always)" >> $GITHUB_ENV | |
- if: ${{ matrix.arch=='linux-arm' }} | |
name: Install gcc for arm | |
run: sudo apt-get install gcc-arm-linux-gnueabi -y | |
- if: ${{ matrix.arch=='linux-arm64' }} | |
name: Install gcc for arm 64 | |
run: sudo apt-get install gcc-aarch64-linux-gnu -y | |
- name: Make the build dir | |
run: mkdir "${{ runner.workspace }}/build" | |
- name: Build | |
run: ${{ matrix.go_opts }} go build -o ${{ runner.workspace }}/build -ldflags "-X main.version=$VERSION -X main.commit=$COMMIT_HASH -X main.date=$BUILD_DATE" ./... | |
- name: Upload zssh binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ runner.workspace }}/build/${{ matrix.zssh_artifact_name }} | |
asset_name: ${{ matrix.zssh_asset_name }} | |
tag: ${{ github.ref }} | |
- name: Upload zscp binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ runner.workspace }}/build/${{ matrix.zscp_artifact_name }} | |
asset_name: ${{ matrix.zscp_asset_name }} | |
tag: ${{ github.ref }} |