Skip to content

新增release脚本

新增release脚本 #1

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
strategy:
matrix:
# Define the target platforms
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: linux
goarch: arm
goarm: 7
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
- goos: windows
goarch: amd64
suffix: .exe
- goos: windows
goarch: arm64
suffix: .exe
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build frontend
working-directory: ./front
run: |
npm install
npm run build
- name: Build backend
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm }}
run: |
CGO_ENABLED=0 go build -o tiny-nav${{ matrix.suffix }}
- name: Package artifacts
run: |
mkdir -p release
tar -czf release/tiny-nav-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm }}.tar.gz tiny-nav${{ matrix.suffix }} LICENSE README.md
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: tiny-nav-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm }}
path: release/*
create-release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
**/tiny-nav-*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}