build-test #53
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: releaser | |
on: | |
push: | |
tags: | |
- 'v*' | |
env: | |
NODE_OPTIONS: "--max-old-space-size=4096" # 增加 Node.js 可用的最大内存,防止构建失败 | |
jobs: | |
build-server: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
- name: Set up dependencies | |
run: sudo apt-get update && sudo apt-get install gcc musl-dev -y | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CGO_ENABLED: 0 | |
GOOS: linux | |
GOARCH: amd64 | |
LDFLAGS: '-extldflags "-static"' | |
build-client: | |
permissions: write-all | |
strategy: | |
fail-fast: false | |
matrix: | |
build: | |
- os: windows-latest | |
GOOS: windows | |
GOARCH: amd64 | |
- os: macos-latest | |
GOOS: darwin | |
GOARCH: arm64 | |
- os: ubuntu-latest | |
GOOS: linux | |
GOARCH: amd64 | |
runs-on: ${{ matrix.build.os }} | |
env: | |
APP_NAME: gpp | |
ZIP_FILE: gpp-${{ matrix.build.GOOS }}-${{ matrix.build.GOARCH }}.zip | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: ./go.mod | |
- run: go version | |
- run: node -v | |
- name: Install dependencies | |
run: | | |
cd frontend && npm install | |
go install github.com/wailsapp/wails/v2/cmd/wails@latest | |
# Dependencies: GNU/Linux | |
- name: Update system and dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev | |
# Build | |
- name: Build for ${{ matrix.build.GOOS }}-${{ matrix.build.GOARCH }} | |
env: | |
GOOS: ${{ matrix.build.GOOS }} | |
GOARCH: ${{ matrix.build.GOARCH }} | |
run: ~/go/bin/wails build -m -trimpath -tags webkit2_41,with_quic -o ${{ env.APP_NAME }}.exe | |
# Compress: macOS | |
- name: Create a compressed file for macOS | |
if: runner.os == 'macOS' | |
run: | | |
cd ./build/bin | |
# The compiled product name of macos is always "${{ env.APP_NAME }}.app" | |
zip -q -r ${{ env.ZIP_FILE }} ${{ env.APP_NAME }}.app | |
# Compress: Windows | |
- name: Create a compressed file for Windows | |
if: runner.os == 'Windows' | |
run: | | |
cd ./build/bin | |
Compress-Archive -Path ${{ env.APP_NAME }}.exe -DestinationPath ${{ env.ZIP_FILE }} | |
# Compress: GNU/Linux | |
- name: Create a compressed file for GNU/Linux | |
if: runner.os == 'Linux' | |
run: | | |
cd ./build/bin | |
mv ${{ env.APP_NAME }}.exe ${{ env.APP_NAME }} | |
zip ${{ env.ZIP_FILE }} ${{ env.APP_NAME }} | |
# Artifact | |
# - name: Upload Artifact ${{ env.ZIP_FILE }} | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: ${{ env.ZIP_FILE }} | |
# path: ./build/bin/${{ env.ZIP_FILE }} | |
- name: Create Release and Upload Assets | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./build/bin/${{ env.ZIP_FILE }} | |
asset_name: ${{ env.ZIP_FILE }} | |
tag: ${{ github.ref }} | |
release_name: ${{ github.ref_name }} | |
overwrite: true | |
draft: false | |
prerelease: false | |
body: | | |
Auto-generated release from GitHub Actions. |