Skip to content

Fix workflow: Windows build doesn't need GOOS #7

Fix workflow: Windows build doesn't need GOOS

Fix workflow: Windows build doesn't need GOOS #7

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Build Linux
if: matrix.os == 'ubuntu-latest'
run: GOOS=linux go build -ldflags "-s -w" -o mhr-cfw-go ./cmd/mhr-cfw
- name: Build Windows
if: matrix.os == 'windows-latest'
run: go build -ldflags "-s -w" -o mhr-cfw-go.exe ./cmd/mhr-cfw
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mhr-cfw-go-${{ matrix.os }}
path: mhr-cfw-go*
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: mhr-cfw-go-ubuntu-latest
path: .
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: mhr-cfw-go-windows-latest
path: .
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
mhr-cfw-go
mhr-cfw-go.exe
body: "Built from commit ${{ github.sha }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}