79 lines
No EOL
2.4 KiB
YAML
79 lines
No EOL
2.4 KiB
YAML
name: Build and Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: 9950x
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.21'
|
|
|
|
- name: Install UPX
|
|
run: |
|
|
wget -O upx.tar.xz https://github.com/upx/upx/releases/download/v5.0.1/upx-5.0.1-amd64_linux.tar.xz
|
|
tar -xf upx.tar.xz
|
|
cp upx-5.0.1-amd64_linux/upx /usr/local/bin/
|
|
cp upx-5.0.1-amd64_linux/upx.1 /usr/local/share/man/man1/ || true
|
|
chmod +x /usr/local/bin/upx
|
|
|
|
- name: Build normal binary
|
|
run: |
|
|
go build -o fps-go-brr .
|
|
|
|
- name: Build compact binary
|
|
run: |
|
|
./build-compact.sh
|
|
|
|
- name: Get version
|
|
id: version
|
|
run: |
|
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "version=dev-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Create release directory
|
|
run: |
|
|
mkdir -p release
|
|
cp fps-go-brr release/fps-go-brr-${{ steps.version.outputs.version }}
|
|
cp fps-go-brr-compact release/fps-go-brr-compact-${{ steps.version.outputs.version }}
|
|
|
|
- name: Upload normal binary
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: fps-go-brr-normal-${{ steps.version.outputs.version }}
|
|
path: release/fps-go-brr-${{ steps.version.outputs.version }}
|
|
|
|
- name: Upload compact binary
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: fps-go-brr-compact-${{ steps.version.outputs.version }}
|
|
path: release/fps-go-brr-compact-${{ steps.version.outputs.version }}
|
|
|
|
- name: Create Release
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: actions/forgejo-release@v2
|
|
with:
|
|
direction: upload
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
release-dir: release
|
|
release-notes: |
|
|
## fps-go-brr ${{ steps.version.outputs.version }}
|
|
|
|
### Downloads
|
|
- `fps-go-brr-${{ steps.version.outputs.version }}` - Normal build
|
|
- `fps-go-brr-compact-${{ steps.version.outputs.version }}` - Compact build (optimized with UPX compression)
|
|
|
|
The compact build is smaller but may have slightly slower startup time due to decompression. |