Build for Windows #11
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: Build for Windows | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- 'v*' # Trigger on version tags (e.g., v1.0.0) | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
# Set up Go | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23 | |
# Install dependencies and run the tests | |
- name: Install Dependencies | |
run: | | |
choco install make -y | |
make format | |
make test | |
continue-on-error: false | |
# Build the application | |
- name: Build for Windows | |
run: | | |
make build GOGG_BINARY=gogg.exe | |
continue-on-error: false | |
# Debug: List Build Directory | |
- name: List Build Directory | |
run: ls -R bin | |
# Upload Build Artifact (always runs) | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: gogg-windows-amd64 | |
path: 'bin/gogg.exe' | |
# Conditional Release Creation (only runs on tag push) | |
- name: Create GitHub Release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "bin/gogg.exe" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: ${{ github.ref_name }} | |
tag: ${{ github.ref_name }} | |
body: | | |
Release version ${{ github.ref_name }} | |
- Built for Windows (amd64) | |
draft: false | |
prerelease: false |