-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Go | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Set up Go 1.13 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: 'master' | ||
fetch-depth: '0' | ||
|
||
- name: Generate Git log | ||
run: | | ||
git fetch origin +refs/tags/*:refs/tags/* | ||
GITVER=$(git describe --tags) | ||
PREVVER=$(git describe --tags --abbrev=0 ${GITVER}~1) | ||
git log --oneline ${PREVVER}..${GITVER} > gitlogs.txt | ||
- name: Get dependencies | ||
run: | | ||
go get -v -t -d ./... | ||
- name: Build | ||
run: | | ||
GITVER=$(git describe --tags || git rev-parse --short HEAD) | ||
LDFLAGS="main.YDAppId=${{ secrets.YDAPPID }} -X main.YDAppSec=${{ secrets.YDAPPSEC }} -X main.MAINVER=${GITVER} -s -w" | ||
GOOS=linux GOARCH=amd64 go build -ldflags="$LDFLAGS" -v -o ydgo_amd64_linux | ||
GOOS=darwin GOARCH=amd64 go build -ldflags="$LDFLAGS" -v -o ydgo_amd64_darwin | ||
GOOS=windows GOARCH=amd64 go build -ldflags="$LDFLAGS" -v -o ydgo_amd64_windows.exe | ||
zip ydgo_amd64_linux.zip ydgo_amd64_linux | ||
zip ydgo_amd64_darwin.zip ydgo_amd64_darwin | ||
zip ydgo_amd64_windows.zip ydgo_amd64_windows.exe | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
prerelease: false | ||
draft: false | ||
body_path: gitlogs.txt | ||
files: | | ||
ydgo_amd64_linux.zip | ||
ydgo_amd64_windows.zip | ||
ydgo_amd64_darwin.zip | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
go 1.13 | ||
|
||
module github.com/boypt/ydgo | ||
|
||
require ( | ||
|