mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-13 01:57:28 +08:00
99 lines
2.6 KiB
YAML
99 lines
2.6 KiB
YAML
name: release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Release tag (e.g. v1.2.3). If empty, uses current ref name.'
|
|
required: false
|
|
type: string
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build-and-package:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
|
|
- name: Install packaging tools
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y zip
|
|
|
|
- name: Build all platforms
|
|
run: |
|
|
make build-all BUILD_TARGETS="linux/amd64 linux/arm64 linux/riscv64 darwin/amd64 darwin/arm64 windows/amd64 windows/arm64"
|
|
|
|
- name: Package artifacts
|
|
run: make package-all BUILD_TARGETS="linux/amd64 linux/arm64 linux/riscv64 darwin/amd64 darwin/arm64 windows/amd64 windows/arm64"
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
cache-dependency-path: webui/package-lock.json
|
|
|
|
- name: Build WebUI
|
|
run: |
|
|
if [ -f webui/package-lock.json ]; then
|
|
npm ci --prefix webui
|
|
else
|
|
npm install --prefix webui
|
|
fi
|
|
npm run build --prefix webui
|
|
tar -czf build/webui.tar.gz -C webui dist
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release-artifacts
|
|
path: |
|
|
build/*.tar.gz
|
|
build/*.zip
|
|
build/checksums.txt
|
|
if-no-files-found: error
|
|
|
|
publish-release:
|
|
needs: build-and-package
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: release-artifacts
|
|
path: build
|
|
|
|
- name: Resolve tag
|
|
id: tag
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.tag }}" ]; then
|
|
echo "name=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "name=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ steps.tag.outputs.name }}
|
|
name: ${{ steps.tag.outputs.name }}
|
|
generate_release_notes: true
|
|
files: |
|
|
build/*.tar.gz
|
|
build/*.zip
|
|
build/checksums.txt
|