Release #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- '*' | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to release, eg. v0.0.1' | |
required: true | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: Build | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# TODO: Add support for arm based runners when GH makes them generally available | |
- runner: macos-latest | |
goos: darwin | |
goarch: arm64 | |
- runner: ubuntu-latest | |
goos: linux | |
goarch: amd64 | |
- runner: windows-latest | |
goos: windows | |
goarch: amd64 | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.x | |
- name: Setup Executable Name | |
# Examples: | |
# - 'network-hub-linux-amd64' | |
# - 'network-hub-windows-amd64.exe' | |
# - 'network-hub-macos-arm64' | |
run: echo "EXECUTABLE_NAME=network-hub-${{ matrix.goos == 'darwin' && 'macos' || matrix.goos }}-${{ matrix.goarch }}${{ runner.os == 'Windows' && '.exe' || '' }}" >> $GITHUB_ENV | |
- name: Build binary | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
run: | | |
go build -v -o ${{ env.EXECUTABLE_NAME }} ./cmd/main.go | |
- name: Upload Executable | |
uses: xresloader/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ inputs.tag || github.ref_name }} | |
file: ${{ env.EXECUTABLE_NAME }} | |
overwrite: true |