mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-20 06:20:08 +08:00
🚧 测试action
This commit is contained in:
parent
2cff0b4e38
commit
2c7400d9d8
90
.github/workflows/release.yml
vendored
90
.github/workflows/release.yml
vendored
@ -1,32 +1,72 @@
|
|||||||
|
name: Compile ZeroBot-Plugin
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
release:
|
release:
|
||||||
types: [created]
|
types:
|
||||||
|
- created
|
||||||
|
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
releases-matrix:
|
my-job:
|
||||||
name: Build ZeroBot-Plugin 🚀
|
name: Build ZeroBot-Plugin 🚀
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/386, darwin/amd64
|
|
||||||
goos: [linux, windows, darwin]
|
|
||||||
goarch: ["386", amd64, arm]
|
|
||||||
exclude:
|
|
||||||
- goos: darwin
|
|
||||||
goarch: arm
|
|
||||||
- goos: darwin
|
|
||||||
goarch: "386"
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Set RELEASE_VERSION env
|
- name: Set up Go
|
||||||
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
|
uses: actions/setup-go@v2
|
||||||
- uses: pcrbot/go-release-action@master
|
with:
|
||||||
env:
|
go-version: 1.15
|
||||||
CGO_ENABLED: 1
|
|
||||||
with:
|
- name: Check out code into the Go module directory
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
uses: actions/checkout@v2
|
||||||
goos: ${{ matrix.goos }}
|
|
||||||
goarch: ${{ matrix.goarch }}
|
- name: Cache Go
|
||||||
goversion: "https://golang.org/dl/go1.15.3.linux-amd64.tar.gz"
|
id: cache
|
||||||
ldflags: -w -s -X "github.com/Yiwen-Chan/ZeroBot-Plugin/gm.Version=${{ env.RELEASE_VERSION }}"
|
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
|
||||||
|
run: export GOOS=linux; export GOARCH=amd64; export CGO_ENABLED=1; go build -ldflags="-s -w -extldflags '-static'" -o artifacts/ZeroBot-Plugin-windows.exe
|
||||||
|
|
||||||
|
- name: Build windows
|
||||||
|
run: export GOOS=windows; export GOARCH=amd64; export CGO_ENABLED=1; go build -ldflags="-s -w -extldflags '-static'" -o artifacts/ZeroBot-Plugin-linux
|
||||||
|
|
||||||
|
- name: Upload Build Artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
# Artifact name
|
||||||
|
name: ZeroBot-Plugin
|
||||||
|
# A file, directory or wildcard pattern that describes what to upload
|
||||||
|
path: ./artifacts
|
||||||
|
|
||||||
|
- name: Gets latest created release info
|
||||||
|
id: latest_release_info
|
||||||
|
uses: jossef/action-latest-release-info@v1.1.0
|
||||||
|
|
||||||
|
- name: Upload linux asset to github release page
|
||||||
|
id: upload-release-asset
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.latest_release_info.outputs.upload_url }}
|
||||||
|
asset_path: ./artifacts/ZeroBot-Plugin-linux
|
||||||
|
asset_name: ZeroBot-Plugin-linux
|
||||||
|
asset_content_type: application/zip
|
||||||
|
|
||||||
|
- name: Upload windows asset to github release page
|
||||||
|
id: upload-release-asset
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.latest_release_info.outputs.upload_url }}
|
||||||
|
asset_path: ./artifacts/ZeroBot-Plugin-windows.exe
|
||||||
|
asset_name: ZeroBot-Plugin-windows.exe
|
||||||
|
asset_content_type: application/zip
|
||||||
Loading…
Reference in New Issue
Block a user