Skip to content

Merge pull request #5 from 0xarchit/optimization #21

Merge pull request #5 from 0xarchit/optimization

Merge pull request #5 from 0xarchit/optimization #21

Workflow file for this run

name: Release Build
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
release:
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Validate tag format
shell: bash
run: |
TAG="${GITHUB_REF_NAME}"
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "ERROR: Tag '$TAG' does not match expected format vX.Y.Z"
exit 1
fi
- name: Set Version
id: set_version
shell: bash
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Detected version from tag: $VERSION"
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: "1.26"
cache: false
- name: Install NSIS
run: |
choco install nsis -y
echo "C:\Program Files (x86)\NSIS" >> $env:GITHUB_PATH
- name: Build
env:
CGO_ENABLED: 0
run: |
go build -ldflags="-s -w -X 'focusd/system.Version=${{ env.VERSION }}'" -trimpath -o focusd.exe ./cmd/focusd
go build -ldflags="-s -w -H=windowsgui -X 'focusd/system.Version=${{ env.VERSION }}'" -trimpath -o focusd_daemon.exe ./cmd/focusd_daemon
- name: Build NSIS Installer
run: |
makensis /DVERSION=${{ env.VERSION }} installer.nsi
- name: Generate Checksum
shell: powershell
run: |
$hashSetup = (Get-FileHash -Path focusd_setup.exe -Algorithm SHA256).Hash.ToLower()
"$hashSetup focusd_setup.exe" | Out-File -FilePath checksums.txt -Encoding ASCII
- name: Generate Release Notes
env:
GH_MODELS_API_KEY: ${{ secrets.GH_MODELS_API_KEY }}
run: |
go run ./cmd/release_notes
- name: Create Release
uses: softprops/action-gh-release@v3
with:
name: focusd v${{ env.VERSION }}
body_path: release_notes.md
files: |
focusd_setup.exe
checksums.txt
token: ${{ secrets.GIT_TOKEN }}