Files
OpenFlare/.github/workflows/linux-release.yml
T

132 lines
3.4 KiB
YAML

name: Server Release
permissions:
contents: write
on:
push:
tags:
- "*"
env:
VERSION: ${{ github.ref_name }}
jobs:
build-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Build Frontend
env:
CI: ""
run: |
cd atsf_server/web
npm install
REACT_APP_VERSION="$VERSION" npm run build
- name: Upload Frontend Artifact
uses: actions/upload-artifact@v4
with:
name: frontend-build
path: atsf_server/web/build
retention-days: 1
build-binaries:
needs: build-frontend
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
asset_name: atsflare-server-linux-amd64
- goos: linux
goarch: arm64
asset_name: atsflare-server-linux-arm64
- goos: darwin
goarch: amd64
asset_name: atsflare-server-darwin-amd64
- goos: darwin
goarch: arm64
asset_name: atsflare-server-darwin-arm64
- goos: windows
goarch: amd64
asset_name: atsflare-server-windows-amd64.exe
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Frontend Artifact
uses: actions/download-artifact@v4
with:
name: frontend-build
path: atsf_server/web/build
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: atsf_server/go.mod
- name: Build Server
working-directory: atsf_server
env:
CGO_ENABLED: 0
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
ASSET_NAME: ${{ matrix.asset_name }}
run: |
go mod download
mkdir -p ../dist
go build -trimpath -ldflags "-s -w -X 'atsflare/common.Version=$VERSION'" -o "../dist/$ASSET_NAME" .
- name: Upload Binary Artifact
uses: actions/upload-artifact@v4
with:
name: server-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/${{ matrix.asset_name }}
retention-days: 1
release:
needs: build-binaries
runs-on: ubuntu-latest
steps:
- name: Download Binary Artifacts
uses: actions/download-artifact@v4
with:
pattern: server-*
path: dist
merge-multiple: true
- name: Determine prerelease
id: prerelease
run: |
TAG="$VERSION"
if [[ "$TAG" == *alpha* ]] || [[ "$TAG" == *beta* ]] || [[ "$TAG" == *rc* ]]; then
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
fi
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/*
draft: false
prerelease: ${{ steps.prerelease.outputs.is_prerelease }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}