Skip to content

v0.0.6: UI improvements and data completeness #8

v0.0.6: UI improvements and data completeness

v0.0.6: UI improvements and data completeness #8

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g., v0.1.1)'
required: true
type: string
permissions:
contents: write
jobs:
validate:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Validate tag format
run: |
TAG="${{ inputs.tag }}"
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+ ]]; then
echo "Error: Tag must begin with 'v' followed by version number (e.g., v1.0, v1.0.1, v2.0.0-beta.1)"
echo "Provided tag: $TAG"
exit 1
fi
echo "Tag format valid: $TAG"
build:
runs-on: ubuntu-latest
needs: [validate]
if: ${{ always() && (needs.validate.result == 'success' || needs.validate.result == 'skipped') }}
strategy:
matrix:
include:
- goos: linux
goarch: amd64
suffix: ''
- goos: linux
goarch: arm64
suffix: ''
- goos: windows
goarch: amd64
suffix: '.exe'
# - goos: windows
# goarch: arm64
# suffix: '.exe'
# - goos: darwin
# goarch: amd64
# suffix: ''
# - goos: darwin
# goarch: arm64
# suffix: ''
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Determine version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
mkdir -p dist
go build -ldflags="-s -w -X main.Version=${{ steps.version.outputs.version }} -X main.BuildTime=${BUILD_TIME} -X main.CommitHash=${SHORT_SHA}" -o dist/stock-fetcher-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: stock-fetcher-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/stock-fetcher-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}
release:
needs: build
if: ${{ always() && needs.build.result == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Determine version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
- name: Create and push tag (manual trigger only)
if: github.event_name == 'workflow_dispatch'
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git tag ${{ steps.version.outputs.version }}
git push origin ${{ steps.version.outputs.version }}
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: List artifacts
run: ls -la dist/
- name: Create checksums
run: |
cd dist
sha256sum * > checksums.txt
cat checksums.txt
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
draft: false
prerelease: ${{ contains(steps.version.outputs.version, '-') }}
generate_release_notes: true
files: |
dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}