Skip to content

Build and Upload hfsubset Executables #1

Build and Upload hfsubset Executables

Build and Upload hfsubset Executables #1

Workflow file for this run

on:
workflow_dispatch:
inputs:
version:
description: 'hfsubset version'
required: true
type: string
name: Build and Upload hfsubset Executables
jobs:
generate:
name: Generate cross-platform builds
runs-on: ubuntu-latest
permissions:
contents: write
env:
GO_LDFLAGS: "-s -w"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
LICENSE.md
README.md
cli
- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version-file: 'cli/go.mod'
- name: Package MacOS executable (x86_64)
working-directory: ./cli
run: |
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="${GO_LDFLAGS}" -o hfsubset
tar -czvf hfsubset-${{ inputs.version }}-macos_amd64.tar.gz hfsubset ../LICENSE.md ../README.md
rm hfsubset
- name: Package MacOS executable (ARM)
working-directory: ./cli
run: |
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="${GO_LDFLAGS}" -o hfsubset
tar -czvf hfsubset-${{ inputs.version }}-macos_arm64.tar.gz hfsubset ../LICENSE.md ../README.md
rm hfsubset
- name: Package Linux executable (x86_64)
working-directory: ./cli
run: |
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="${GO_LDFLAGS}" -o hfsubset
tar -czvf hfsubset-${{ inputs.version }}-linux_amd64.tar.gz hfsubset ../LICENSE.md ../README.md
rm hfsubset
- name: Package Linux executable (ARM)
working-directory: ./cli
run: |
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="${GO_LDFLAGS}" -o hfsubset
tar -czvf hfsubset-${{ inputs.version }}-linux_arm64.tar.gz hfsubset ../LICENSE.md ../README.md
rm hfsubset
- name: Package Windows executable
working-directory: ./cli
run: |
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="${GO_LDFLAGS}" -o hfsubset.exe
zip hfsubset-${{ inputs.version }}-windows_amd64.zip hfsubset.exe ../LICENSE.md ../README.md
rm hfsubset.exe
- name: Upload packages
uses: ncipollo/release-action@v1
with:
tag: ${{ inputs.version }}
commit: ${{ github.sha }}
artifacts: "cli/hfsubset-*"