Skip to content

Commit

Permalink
build with ci
Browse files Browse the repository at this point in the history
  • Loading branch information
boypt committed Dec 23, 2019
1 parent 008dfd2 commit a66bbd7
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/go.yml
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 }}
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
go 1.13

module github.com/boypt/ydgo

require (
Expand Down

0 comments on commit a66bbd7

Please sign in to comment.