tcping/.github/workflows/main.yml

60 lines
2.1 KiB
YAML
Raw Normal View History

2019-11-09 10:07:49 +08:00
name: build
on:
push:
tags:
- '*'
jobs:
publish_release:
runs-on: ubuntu-latest
steps:
# checkout code
- uses: actions/checkout@master
# create release
- uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- First Change
- Second Change
draft: false
prerelease: false
# build binaries
- uses: actions/setup-go@v1
with:
go-version: '1.13.5'
- name: build
run: |
2020-05-11 22:38:50 +08:00
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
2019-11-09 10:07:49 +08:00
# upload binaries 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 }}
2020-05-11 22:38:50 +08:00
asset_path: ./tcping-linux-amd64.tar.gz
asset_name: tcping-linux-amd64.tar.gz
2019-11-09 10:07:49 +08:00
asset_content_type: application/gzip
# upload binaries 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 }}
2020-05-11 22:38:50 +08:00
asset_path: ./tcping-darwin-amd64.tar.gz
asset_name: tcping-darwin-amd64.tar.gz
2019-11-09 10:07:49 +08:00
asset_content_type: application/gzip