1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-04 23:40:26 +08:00
Files
WireGold/.github/workflows/release.yml
2026-04-11 15:24:57 +08:00

81 lines
2.5 KiB
YAML

name: release
on:
push:
tags:
- v*
env:
GITHUB_TOKEN: ${{ github.token }}
CGO_ENABLED: 0
LDFLAGS: -s -w -checklinkname=0
VERSION_PKG: github.com/fumiama/WireGold/config
jobs:
build:
name: Build ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { name: linux-x64, goos: linux, goarch: amd64 }
- { name: linux-x86, goos: linux, goarch: "386" }
- { name: windows-x64, goos: windows, goarch: amd64, ext: .exe }
- { name: windows-x86, goos: windows, goarch: "386", ext: .exe }
- { name: linux-arm64, goos: linux, goarch: arm64, goarm: "7" }
- { name: linux-armv6, goos: linux, goarch: arm, goarm: "6" }
- { name: linux-mips, goos: linux, goarch: mips }
- { name: linux-mips-softfloat, goos: linux, goarch: mips, gomips: softfloat }
- { name: linux-mipsel, goos: linux, goarch: mipsle }
- { name: linux-mipsel-softfloat, goos: linux, goarch: mipsle, gomips: softfloat }
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm }}
GOMIPS: ${{ matrix.gomips }}
steps:
- name: Set up Go
uses: actions/setup-go@master
with:
go-version: ^1.25
- name: Check out code
uses: actions/checkout@master
- name: Cache Go
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
- name: Tidy Go modules
run: go mod tidy
- name: Build
run: go build -ldflags="${LDFLAGS} -X ${VERSION_PKG}.Version=${GITHUB_REF_NAME#v}" -o wg-${{ matrix.name }}${{ matrix.ext }} -trimpath
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: wg-${{ matrix.name }}
path: wg-${{ matrix.name }}${{ matrix.ext }}
release:
name: Upload Release 🚀
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/wg-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true