chore: add GitHub Actions release workflow, MIT license, and update gitignore
Some checks failed
Release / Build & Release (push) Has been cancelled
Some checks failed
Release / Build & Release (push) Has been cancelled
This commit is contained in:
53
.github/workflows/release.yml
vendored
Normal file
53
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*' # 当推送标签形如 v1.0.0 时触发自动构建
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build & Release
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.21'
|
||||
cache: true
|
||||
|
||||
- name: Download Dependencies
|
||||
run: go mod download
|
||||
|
||||
- name: Compile Cross-Platform Binaries
|
||||
run: |
|
||||
mkdir -p build_output
|
||||
|
||||
echo "Building Windows amd64..."
|
||||
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o build_output/smart-monitor_windows_amd64.exe ./cmd/smart-monitor
|
||||
|
||||
echo "Building Windows arm64..."
|
||||
GOOS=windows GOARCH=arm64 go build -ldflags="-s -w" -o build_output/smart-monitor_windows_arm64.exe ./cmd/smart-monitor
|
||||
|
||||
echo "Building Linux amd64..."
|
||||
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o build_output/smart-monitor_linux_amd64 ./cmd/smart-monitor
|
||||
|
||||
echo "Building Linux arm64..."
|
||||
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o build_output/smart-monitor_linux_arm64 ./cmd/smart-monitor
|
||||
|
||||
- name: Publish GitHub Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: build_output/*
|
||||
draft: false
|
||||
prerelease: false
|
||||
generate_release_notes: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user