Skip to content

Manual Build and Release #3

Manual Build and Release

Manual Build and Release #3

Workflow file for this run

name: Manual Build and Release
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to build'
required: true
default: 'main'
release:
types: [created]
jobs:
test:
name: Run Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: [1.24.1]
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Run tests
run: go test -v ./...
build:
name: Build
needs: test
if: success()
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: [1.24.1]
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
name: ubuntu
extension: ""
- os: macos-latest
goos: darwin
goarch: amd64
name: mac
extension: ""
- os: windows-latest
goos: windows
goarch: amd64
name: win
extension: ".exe"
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Build
run: |
env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -v -o sbstck-dl-${{ matrix.name }}-${{ matrix.goarch }}${{ matrix.extension }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sbstck-dl-${{ matrix.name }}-${{ matrix.goarch }}
path: sbstck-dl-${{ matrix.name }}-${{ matrix.goarch }}${{ matrix.extension }}
release-upload:
name: Attach Artifacts to Release
if: github.event_name == 'release'
needs: build
runs-on: ubuntu-latest
permissions:
contents: write # This is needed for release uploads
steps:
- name: Debug event info
run: |
echo "Event name: ${{ github.event_name }}"
echo "Event type: ${{ github.event.action }}"
echo "Release tag: ${{ github.event.release.tag_name }}"
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: List artifacts
run: find artifacts -type f | sort
- name: Upload artifacts to release
uses: softprops/action-gh-release@v1
with:
files: artifacts/**/*
# GitHub automatically provides this token
token: ${{ github.token }}