Skip to content

Commit

Permalink
Fix binary builder
Browse files Browse the repository at this point in the history
  • Loading branch information
ctessum committed Aug 9, 2021
1 parent ef4aa70 commit 996c16a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 44 deletions.
8 changes: 8 additions & 0 deletions .github/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

cd cmd/inmap

GOOS=windows GOARCH=amd64 go build -o ../../inmap-$SOURCE_TAG-windows-amd64.exe
GOOS=linux GOARCH=amd64 go build -o ../../inmap-$SOURCE_TAG-linux-amd64
GOOS=darwin GOARCH=amd64 go build -o ../../inmap-$SOURCE_TAG-darwin-amd64
GOOS=darwin GOARCH=arm64 go build -o ../../inmap-$SOURCE_TAG-darwin-arm64
53 changes: 9 additions & 44 deletions .github/workflows/upload_assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,60 +8,25 @@ jobs:
name: build binaries
runs-on: ubuntu-latest
steps:
- name: Branch name
id: branch_name
run: |
SOURCE_TAG=${GITHUB_REF#refs/tags/} # Get tag
echo ::set-output name=SOURCE_TAG::$SOURCE_TAG
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.16.x
- name: Checkout code
uses: actions/checkout@v2
- name: Build code
run: |
echo "GO111MODULE=on" >> $GITHUB_ENV
mkdir bin
GOOS=windows GOARCH=amd64 go build -o bin/inmap-windows-amd64.exe
GOOS=linux GOARCH=amd64 go build -o bin/inmap-linux-amd64
GOOS=darwin GOARCH=amd64 go build -o bin/inmap-darwin-amd64
GOOS=darwin GOARCH=arm64 go build -o bin/inmap-darwin-arm64
- name: upload artifacts
uses: actions/upload-artifact@v2
with:
name: binaries
path: bin/
if-no-files-found: error

upload:
name: Upload release assets
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Branch name
id: branch_name
run: |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: Checkout code
uses: actions/checkout@v1

- name: Download build artefacts
uses: actions/download-artifact@v2
with:
name: binaries
path: bin/

- name: Create asset zips
./.github/build.sh
env:
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
run: |
mkdir assets
zip assets/inmap-${SOURCE_TAG}-windows-amd64.exe bin/inmap-windows-amd64.exe
zip assets/inmap-${SOURCE_TAG}-linux-amd64 bin/inmap-linux-amd64
zip assets/inmap-${SOURCE_TAG}-darwin-amd64 bin/inmap-darwin-amd64
zip assets/inmap-${SOURCE_TAG}-darwin-arm64 bin/inmap-darwin-arm64
sha256sum assets/* > assets/SHASUMS256.txt
- name: Upload release assets
- name: Upload the artifacts
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: './assets/*'
args: 'inmap-*'

0 comments on commit 996c16a

Please sign in to comment.