Skip to content

Fixing

Fixing #6

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*.*.*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
arch: [amd64, arm64]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22'
- name: Build binary
run: |
mkdir -p bin
GOOS=$(echo ${{ matrix.os }} | cut -d '-' -f 1)
GOARCH=${{ matrix.arch }}
OUTPUT_NAME=${{ env.PROJECT_NAME }}-${GOOS}-${GOARCH}
if [ $GOOS = "windows" ]; then
OUTPUT_NAME+='.exe'
fi
go build -o bin/${OUTPUT_NAME}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-${{ matrix.arch }}-binary
path: bin/
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download all artifacts
run: |
for os in ubuntu-latest macos-latest windows-latest; do
for arch in amd64 arm64; do
artifact_name="${os}-${arch}-binary"
echo "Downloading $artifact_name"
mkdir -p bin
gh run download ${{ github.run_id }} --name $artifact_name --dir bin/
done
done
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref }}
name: Release ${{ github.ref }}
body: |
Automated release from GitHub Actions.
files: bin/*
token: ${{ secrets.GITHUB_TOKEN }}