Skip to content

Commit

Permalink
added build for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
joeygibson committed Feb 25, 2021
1 parent be87768 commit 680cb74
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
config:
- os: ubuntu-latest
- os: macOS-latest
- os: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -38,15 +39,19 @@ jobs:
with:
go-version: 1.15
- name: Build for release
run: go build -ldflags "-X main.sha1ver=`git rev-parse HEAD` -X main.buildTime=`date +'%Y-%m-%d_%T'` -X main.gitTag=${GITHUB_REF#refs/*/v}"
run: go build -o ${GITHUB_REPOSITORY#joeygibson/} -ldflags "-X main.sha1ver=`git rev-parse HEAD` -X main.buildTime=`date +'%Y-%m-%d_%T'` -X main.gitTag=${GITHUB_REF#refs/*/v}"
shell: bash
- name: Set program name
run: echo "PROGRAM_NAME=${GITHUB_REPOSITORY#joeygibson/}" >> $GITHUB_ENV
shell: bash
- name: Generate binary name
run: ./scripts/generate-binary-name
shell: bash
env:
OS: ${{ matrix.config.os }}
- name: Set permissions
run: chmod 755 ${{ env.PROGRAM_NAME }}
shell: bash
- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
Expand Down
6 changes: 5 additions & 1 deletion scripts/generate-binary-name
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ ARCH=x86_64
if [[ "${OS}" == "macOS-latest" ]]; then
VENDOR=apple
OS=darwin
elif [[ "${OS}" == "windows-latest" ]]; then
VENDOR=microsoft
OS=windows
EXT=.exe
else
VENDOR=unknown
OS=linux
fi

echo "RELEASE_NAME=${PROGRAM_NAME}-${TAG}-${ARCH}-${VENDOR}-${OS}" >> $GITHUB_ENV
echo "RELEASE_NAME=${PROGRAM_NAME}-${TAG}-${ARCH}-${VENDOR}-${OS}${EXT}" >> $GITHUB_ENV

0 comments on commit 680cb74

Please sign in to comment.