Skip to content

Release binaries

Release binaries #1

Workflow file for this run

name: Release binaries
on:
workflow_dispatch:
inputs:
tag:
description: "Release tag, for example v0.1.0"
required: true
type: string
name:
description: "Release name"
required: false
type: string
prerelease:
description: "Mark release as prerelease"
required: true
default: true
type: boolean
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.goos }}-${{ matrix.goarch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
ext: ""
archive: tar.gz
- goos: linux
goarch: arm64
ext: ""
archive: tar.gz
- goos: darwin
goarch: amd64
ext: ""
archive: tar.gz
- goos: darwin
goarch: arm64
ext: ""
archive: tar.gz
- goos: windows
goarch: amd64
ext: ".exe"
archive: zip
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Test
run: go test ./...
- name: Build binaries
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: |
set -euo pipefail
mkdir -p dist/package
go build -trimpath -ldflags="-s -w" -o "dist/package/geoforge${{ matrix.ext }}" ./cmd/builder
go build -trimpath -ldflags="-s -w" -o "dist/package/geoforge-qualitycheck${{ matrix.ext }}" ./cmd/qualitycheck
cp README.md LICENSE THIRD_PARTY_DATA.md admin.env.example dist/package/
- name: Package tar.gz
if: matrix.archive == 'tar.gz'
run: |
set -euo pipefail
name="geoforge_${{ github.event.inputs.tag }}_${{ matrix.goos }}_${{ matrix.goarch }}"
mv dist/package "dist/${name}"
tar -C dist -czf "dist/${name}.tar.gz" "${name}"
- name: Package zip
if: matrix.archive == 'zip'
run: |
set -euo pipefail
name="geoforge_${{ github.event.inputs.tag }}_${{ matrix.goos }}_${{ matrix.goarch }}"
mv dist/package "dist/${name}"
cd dist
zip -r "${name}.zip" "${name}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: geoforge-${{ matrix.goos }}-${{ matrix.goarch }}
path: |
dist/*.tar.gz
dist/*.zip
if-no-files-found: error
release:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
merge-multiple: true
- name: Publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.tag }}
target_commitish: ${{ github.sha }}
name: ${{ github.event.inputs.name || github.event.inputs.tag }}
prerelease: ${{ github.event.inputs.prerelease }}
generate_release_notes: true
files: release-assets/*