ddg-api / .github /workflows /release.yml
dragg2's picture
Upload 11 files
d7dcc9b verified
name: Go Build
on:
release: # 只在Release创建时触发
types:
- created # 当新Release创建时触发
workflow_dispatch: # 手动触发(可选)
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: windows
goarch: 386
- goos: windows
goarch: amd64
- goos: windows
goarch: arm64
- goos: linux
goarch: 386
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: freebsd
goarch: 386
- goos: freebsd
goarch: amd64
- goos: freebsd
goarch: arm64
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Build
run: |
echo "Building for ${{ matrix.goos }} ${{ matrix.goarch }}"
suffix=""
if [ "${{ matrix.goos }}" == "windows" ]; then
suffix=".exe"
fi
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ./build/ddgchatgo-${{ matrix.goos }}-${{ matrix.goarch }}$suffix
- name: Upload release artifact
uses: svenstaro/upload-release-action@v2 # 使用此插件将文件上传到Release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }} # 使用 GitHub 令牌授权
file: ./build/ddgchatgo-${{ matrix.goos }}-${{ matrix.goarch }}* # 上传构建产物
file_glob: true
tag: ${{ github.ref_name }} # 使用Release的标签作为标识
name: ddgchatgo-${{ matrix.goos }}-${{ matrix.goarch }}