1
0
mirror of https://github.com/fumiama/imoto.git synced 2026-06-05 16:50:27 +08:00
Files
imoto/.github/workflows/release.yml
源文雨 a488786d31 v0.1.0
2023-11-17 01:49:15 +09:00

63 lines
2.2 KiB
YAML

name: 发行版
on:
push:
tags:
- v*
env:
GITHUB_TOKEN: ${{ github.token }}
jobs:
my-job:
name: Build imoto on Push Tag 🚀
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.21'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Cache Go
id: cache
uses: actions/cache@v2
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
- name: Tidy Go modules
run: go mod tidy
- name: Build linux-x64
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o artifacts/imoto-linux-x64 cmd/main.go
- name: Build linux-x86
run: CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags="-s -w" -trimpath -o artifacts/imoto-linux-x86 cmd/main.go
- name: Build windows-x64
run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o artifacts/imoto-windows-x64.exe cmd/main.go
- name: Build windows-x86
run: CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags="-s -w" -trimpath -o artifacts/imoto-windows-x86.exe cmd/main.go
- name: Build linux-arm64
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -ldflags="-s -w" -trimpath -o artifacts/imoto-linux-arm64 cmd/main.go
- name: Build linux-armhfv6
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -trimpath -o artifacts/imoto-linux-armhfv6 cmd/main.go
- name: Build darwin-x64
run: CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o artifacts/imoto-darwin-x64 cmd/main.go
- name: Build darwin-arm64
run: CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -trimpath -o artifacts/imoto-darwin-arm64 cmd/main.go
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/imoto-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true