mirror of
https://github.com/IS1DI/x0gp.git
synced 2026-07-16 20:47:55 +00:00
68 lines
1.8 KiB
YAML
68 lines
1.8 KiB
YAML
name: Release Go Binaries
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Binary
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
goos: [linux, darwin, windows]
|
|
goarch: [amd64, arm64]
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: server/go.mod
|
|
|
|
- name: Build Binary
|
|
working-directory: server
|
|
run: |
|
|
mkdir -p bin
|
|
OUT_NAME="poc-server-${{ matrix.goos }}-${{ matrix.goarch }}"
|
|
if [ "${{ matrix.goos }}" = "windows" ]; then
|
|
OUT_NAME="${OUT_NAME}.exe"
|
|
fi
|
|
echo "Building for ${{ matrix.goos }}/${{ matrix.goarch }}..."
|
|
CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags "-s -w -X main.serverVersion=${{ github.ref_name }}" -o bin/${OUT_NAME} ./cmd/poc-server
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: poc-server-${{ matrix.goos }}-${{ matrix.goarch }}
|
|
path: server/bin/
|
|
|
|
release:
|
|
name: Create GitHub Release
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download Artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: release-binaries
|
|
merge-multiple: true
|
|
|
|
- name: Create Release
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
echo "Creating GitHub Release for tag ${{ github.ref_name }}..."
|
|
gh release create "${{ github.ref_name }}" \
|
|
--title "Release ${{ github.ref_name }}" \
|
|
--generate-notes \
|
|
release-binaries/*
|