mirror of
https://gitee.com/johng/gf.git
synced 2024-12-03 20:58:47 +08:00
66 lines
1.7 KiB
YAML
66 lines
1.7 KiB
YAML
name: GoFrame CLI Build Release
|
|
|
|
on:
|
|
push:
|
|
# Sequence of patterns matched against refs/tags
|
|
tags:
|
|
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
|
|
|
|
env:
|
|
TZ: Asia/Shanghai
|
|
|
|
|
|
jobs:
|
|
build:
|
|
name: Build And Release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Github Code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set Up Golang Environment
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.17
|
|
|
|
- name: Build CLI Binary
|
|
run: |
|
|
echo "Building linux amd64 binary..."
|
|
cd cmd/gf
|
|
GOOS=linux GOARCH=amd64 go build main.go
|
|
chmod +x main
|
|
./main install -y
|
|
|
|
- name: Build CLI Binary For All Platform
|
|
run: |
|
|
cd cmd/gf
|
|
gf build main.go -n gf -a all -s all
|
|
|
|
- name: Move Files Before Release
|
|
run: |
|
|
cd cmd/gf/temp
|
|
for OS in *;do for FILE in $OS/*;\
|
|
do if [[ ${OS} =~ 'windows' ]];\
|
|
then mv $FILE gf_$OS.exe && rm -rf $OS;\
|
|
else mv $FILE gf_$OS && rm -rf $OS;\
|
|
fi;done;done
|
|
|
|
- name: Create Github Release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
release_name: GoFrame CLI Release ${{ github.ref }}
|
|
draft: false
|
|
prerelease: false
|
|
|
|
- name: Upload Release Asset
|
|
id: upload-release-asset
|
|
uses: alexellis/upload-assets@0.2.2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
asset_paths: '["cmd/gf/temp/gf_*"]'
|