Skip to content

Commit

Permalink
use env for key
Browse files Browse the repository at this point in the history
  • Loading branch information
boypt committed Dec 23, 2019
1 parent a66bbd7 commit 81eb331
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ jobs:
go get -v -t -d ./...
- name: Build
env:
YDAPPID: ${{ secrets.YDAPPID }}
YDAPPSEC: ${{ secrets.YDAPPSEC }}
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
bash make_release.sh
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
Expand Down
11 changes: 8 additions & 3 deletions make_release.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/bin/bash
YDAPPID=""
YDAPPSEC=""
source .ydkey #
if [[ -f .ydkey ]]; then
source .ydkey
fi

if [[ -z $YDAPPID ]] || [[ -z $YDAPPSEC ]]; then
echo "APPID/SEC unset"
exit 1
fi

VER=$(git describe --tags || git rev-parse --short HEAD)
LDFLAGS="-s -w -X main.VERSION=$VER -X main.YDAppId=$YDAPPID -X main.YDAppSec=$YDAPPSEC"
Expand Down

0 comments on commit 81eb331

Please sign in to comment.