Update workflow: build for both Windows and Linux

This commit is contained in:
ThisIsDara
2026-05-06 23:05:28 +03:30
parent 1f839335b9
commit f003a03959
+34 -9
View File
@@ -7,7 +7,10 @@ on:
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
permissions:
contents: write
steps:
@@ -18,25 +21,47 @@ jobs:
with:
go-version: '1.22'
- name: Build
run: go build -ldflags "-s -w" -o mhr-cfw-go.exe ./cmd/mhr-cfw
- 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: GOOS=windows 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
path: mhr-cfw-go.exe
name: mhr-cfw-go-${{ matrix.os }}
path: mhr-cfw-go*
- name: Download artifact
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
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.exe
files: |
mhr-cfw-go
mhr-cfw-go.exe
body: "Built from commit ${{ github.sha }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}