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: publish_release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
# checkout code - name: Checkout code
- uses: actions/checkout@master uses: actions/checkout@master
# create release
- uses: actions/create-release@v1 - name: Create release
uses: actions/create-release@v1
id: create_release id: create_release
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -23,37 +24,39 @@ jobs:
Changes in this Release Changes in this Release
- First Change - First Change
- Second Change - Second Change
draft: false draft: true
prerelease: false prerelease: true
# build binaries
- uses: actions/setup-go@v1 - name: Setup Go
uses: actions/setup-go@v1
with: with:
go-version: '1.13.5' go-version: '1.13.5'
- name: build
- name: Build
run: | run: |
mkdir tcping-linux-amd64 cd cmd/tcping
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 *.go'
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 *.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' ls -lha
tar -C $PWD -cvzf tcping-linux-amd64.tar.gz tcping-linux-amd64
tar -C $PWD -cvzf tcping-darwin-amd64.tar.gz tcping-darwin-amd64 - name: Upload binary linux
# upload binaries linux uses: actions/upload-release-asset@v1.0.1
- uses: actions/upload-release-asset@v1.0.1
id: upload-release-asset-linux id: upload-release-asset-linux
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ steps.create_release.outputs.upload_url }} upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tcping-linux-amd64.tar.gz asset_path: ./cmd/tcping/tcping-linux-amd64
asset_name: tcping-linux-amd64.tar.gz asset_name: tcping-linux-amd64
asset_content_type: application/gzip asset_content_type: application/octet-stream
# upload binaries darwin
- uses: actions/upload-release-asset@v1.0.1 - name: Upload binary darwin
uses: actions/upload-release-asset@v1.0.1
id: upload-release-asset-darwin id: upload-release-asset-darwin
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ steps.create_release.outputs.upload_url }} upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tcping-darwin-amd64.tar.gz asset_path: ./cmd/tcping/tcping-darwin-amd64
asset_name: tcping-darwin-amd64.tar.gz asset_name: tcping-darwin-amd64
asset_content_type: application/gzip asset_content_type: application/octet-stream

View File

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