Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [main]
pull_request:
branches: [main]
workflow_call:

jobs:
ci:
Expand Down
92 changes: 92 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Publish

on:
push:
tags:
- "v*"

permissions:
contents: write

jobs:
validate-tag:
runs-on: ubuntu-latest
steps:
- name: Validate semver format
run: |
TAG="${GITHUB_REF#refs/tags/}"
VERSION="${TAG#v}"
if ! npx semver "$VERSION" > /dev/null 2>&1; then
echo "Error: Tag '$TAG' is not a valid semver format"
echo "Expected format: vMAJOR.MINOR.PATCH[-PRERELEASE][+BUILD]"
exit 1
fi
echo "Tag '$TAG' is valid semver"

ci:
uses: ./.github/workflows/ci.yaml

build:
needs: [validate-tag, ci]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: windows
goarch: amd64
- goos: windows
goarch: arm64

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25.6"

- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
BINARY_NAME="goanywhere-${{ matrix.goos }}-${{ matrix.goarch }}"
if [ "${{ matrix.goos }}" = "windows" ]; then
BINARY_NAME="${BINARY_NAME}.exe"
fi
go build -ldflags="-s -w" -o "${BINARY_NAME}" ./cmd/goanywhere

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

release:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: artifacts/*