diff --git a/.github/build.sh b/.github/build.sh new file mode 100755 index 000000000..c6ca754c2 --- /dev/null +++ b/.github/build.sh @@ -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 \ No newline at end of file diff --git a/.github/workflows/upload_assets.yml b/.github/workflows/upload_assets.yml index d558615ec..cbe288a3b 100644 --- a/.github/workflows/upload_assets.yml +++ b/.github/workflows/upload_assets.yml @@ -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/*' \ No newline at end of file + args: 'inmap-*' \ No newline at end of file