Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# This workflow builds cross-platform binaries and publishes a GitHub Release
# when a version tag (e.g. v1.2.3) is pushed.

name: Release

on:
push:
tags:
- 'v*'

jobs:

test:
name: Test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.26'

- name: Test
run: go test -v ./...

build:
name: Build (${{ matrix.goos }}/${{ matrix.goarch }})
runs-on: ubuntu-latest
needs: test
permissions:
contents: read
strategy:
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
- goos: windows
goarch: amd64

steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.26'

- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
OUTPUT="ksef-cli-${{ matrix.goos }}-${{ matrix.goarch }}"
if [ "${{ matrix.goos }}" = "windows" ]; then
OUTPUT="${OUTPUT}.exe"
fi
go build -o "${OUTPUT}" .

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ksef-cli-${{ matrix.goos }}-${{ matrix.goarch }}
path: ksef-cli-${{ matrix.goos }}-${{ matrix.goarch }}*

release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Create release and upload binaries
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
Loading