Update workflow

This commit is contained in:
i3h 2020-07-21 10:56:37 +08:00
parent 23ed54d16e
commit d65df1eafe
2 changed files with 29 additions and 26 deletions

View File

@ -9,10 +9,11 @@ jobs:
publish_release:
runs-on: ubuntu-latest
steps:
# checkout code
- uses: actions/checkout@master
# create release
- uses: actions/create-release@v1
- name: Checkout code
uses: actions/checkout@master
- name: Create release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -23,37 +24,39 @@ jobs:
Changes in this Release
- First Change
- Second Change
draft: false
prerelease: false
# build binaries
- uses: actions/setup-go@v1
draft: true
prerelease: true
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: '1.13.5'
- name: build
- name: Build
run: |
mkdir tcping-linux-amd64
mkdir tcping-darwin-amd64
env VERSION=$(echo ${GITHUB_REF:10}) GIN_MODE=release GOOS=linux GOARCH=amd64 bash -c 'go build -ldflags "-X main.VersionString=$VERSION" -o tcping-linux-amd64/tcping *.go'
env VERSION=$(echo ${GITHUB_REF:10}) GIN_MODE=release GOOS=darwin GOARCH=amd64 bash -c 'go build -ldflags "-X main.VersionString=$VERSION" -o tcping-darwin-amd64/tcping *.go'
tar -C $PWD -cvzf tcping-linux-amd64.tar.gz tcping-linux-amd64
tar -C $PWD -cvzf tcping-darwin-amd64.tar.gz tcping-darwin-amd64
# upload binaries linux
- uses: actions/upload-release-asset@v1.0.1
cd cmd/tcping
env VERSION=$(echo ${GITHUB_REF:10}) GIN_MODE=release GOOS=linux GOARCH=amd64 bash -c 'go build -ldflags "-X main.VersionString=$VERSION" -o tcping-linux-amd64 *.go'
env VERSION=$(echo ${GITHUB_REF:10}) GIN_MODE=release GOOS=darwin GOARCH=amd64 bash -c 'go build -ldflags "-X main.VersionString=$VERSION" -o tcping-darwin-amd64 *.go'
ls -lha
- name: Upload binary linux
uses: actions/upload-release-asset@v1.0.1
id: upload-release-asset-linux
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tcping-linux-amd64.tar.gz
asset_name: tcping-linux-amd64.tar.gz
asset_content_type: application/gzip
# upload binaries darwin
- uses: actions/upload-release-asset@v1.0.1
asset_path: ./cmd/tcping/tcping-linux-amd64
asset_name: tcping-linux-amd64
asset_content_type: application/octet-stream
- name: Upload binary darwin
uses: actions/upload-release-asset@v1.0.1
id: upload-release-asset-darwin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tcping-darwin-amd64.tar.gz
asset_name: tcping-darwin-amd64.tar.gz
asset_content_type: application/gzip
asset_path: ./cmd/tcping/tcping-darwin-amd64
asset_name: tcping-darwin-amd64
asset_content_type: application/octet-stream

View File

@ -13,7 +13,7 @@ import (
)
var (
VersionString string = "v1.1.0"
VersionString string
)
func init() {