Skip to content

Release

Release #2

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: linux
arch: amd64
goos: linux
goarch: amd64
- os: linux
arch: arm64
goos: linux
goarch: arm64
- os: darwin
arch: amd64
goos: darwin
goarch: amd64
- os: darwin
arch: arm64
goos: darwin
goarch: arm64
- os: windows
arch: amd64
goos: windows
goarch: amd64
- os: windows
arch: arm64
goos: windows
goarch: arm64
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.24'
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
if [ "${{ matrix.goos }}" = "windows" ]; then
go build -ldflags="-s -w" -o jh-${{ matrix.os }}-${{ matrix.arch }}.exe .
else
go build -ldflags="-s -w" -o jh-${{ matrix.os }}-${{ matrix.arch }} .
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: jh-${{ matrix.os }}-${{ matrix.arch }}
path: jh-*
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
**/jh-*
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}