Skip to content

docs: changelog updated #361

docs: changelog updated

docs: changelog updated #361

name: Go Build, Test and Publish Artifacts
on:
push:
branches: [ main ]
tags:
- '*'
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
target: [linux, windows]
permissions:
contents: write
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '>=1.23.4'
- name: Set version
run: echo "BUILD_VERSION=$(git describe --tags --long || TZ=UTC0 git show -s --date='format-local:%Y%m%d-%H%M' --format='%cd-%h')" >> $GITHUB_ENV
- name: Run tests
run: go test -v ./...
- name: Build linux amd64 binaries
if: matrix.target == 'linux'
run: env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -x -buildvcs=true -ldflags "-s -w -X=main.Version=${{ env.BUILD_VERSION }}" -o Perpetual_amd64.bin github.com/DarkCaster/Perpetual
- name: Build linux arm64 binaries
if: matrix.target == 'linux'
run: env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -v -x -buildvcs=true -ldflags "-s -w -X=main.Version=${{ env.BUILD_VERSION }}" -o Perpetual_arm64.bin github.com/DarkCaster/Perpetual
- name: Build linux x86 binaries
if: matrix.target == 'linux'
run: env CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -v -x -buildvcs=true -ldflags "-s -w -X=main.Version=${{ env.BUILD_VERSION }}" -o Perpetual_x86.bin github.com/DarkCaster/Perpetual
- name: Build windows amd64 binaries
if: matrix.target == 'windows'
run: env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -v -x -buildvcs=true -ldflags "-s -w -X=main.Version=${{ env.BUILD_VERSION }}" -o Perpetual_amd64.exe github.com/DarkCaster/Perpetual
- name: Build windows arm64 binaries
if: matrix.target == 'windows'
run: env CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -v -x -buildvcs=true -ldflags "-s -w -X=main.Version=${{ env.BUILD_VERSION }}" -o Perpetual_arm64.exe github.com/DarkCaster/Perpetual
- name: Build windows x86 binaries
if: matrix.target == 'windows'
run: env CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -v -x -buildvcs=true -ldflags "-s -w -X=main.Version=${{ env.BUILD_VERSION }}" -o Perpetual_x86.exe github.com/DarkCaster/Perpetual
- name: Upload linux artifacts
if: matrix.target == 'linux'
uses: actions/upload-artifact@v4
with:
name: linux-binaries
path: |
Perpetual_*.bin
- name: Upload windows artifacts
if: matrix.target == 'windows'
uses: actions/upload-artifact@v4
with:
name: windows-binaries
path: |
Perpetual_*.exe
- name: Archive windows binaries for release
if: ${{ (matrix.target == 'windows') && startsWith(github.event.ref, 'refs/tags/v') }}
run: zip Windows_Binaries.zip Perpetual_*.exe
- name: Archive linux binaries for release
if: ${{ (matrix.target == 'linux') && startsWith(github.event.ref, 'refs/tags/v') }}
run: zip Linux_Binaries.zip Perpetual_*.bin
- name: Publish windows release
if: ${{ (matrix.target == 'windows') && startsWith(github.event.ref, 'refs/tags/v') }}
uses: ncipollo/release-action@v1
with:
prerelease: true
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
artifacts: "Windows_Binaries.zip"
- name: Publish linux release
if: ${{ (matrix.target == 'linux') && startsWith(github.event.ref, 'refs/tags/v') }}
uses: ncipollo/release-action@v1
with:
prerelease: true
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
artifacts: "Linux_Binaries.zip"