From 32eb7c3b495bcc6d103ac6bc4827dd56b9559d12 Mon Sep 17 00:00:00 2001 From: David Haukeness Date: Wed, 18 Mar 2020 12:04:39 -0600 Subject: [PATCH] Create build_go.yml --- .github/workflows/build_go.yml | 84 ++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .github/workflows/build_go.yml diff --git a/.github/workflows/build_go.yml b/.github/workflows/build_go.yml new file mode 100644 index 0000000..54a8aab --- /dev/null +++ b/.github/workflows/build_go.yml @@ -0,0 +1,84 @@ +name: Build + +on: + push: + branches: [ master ] + tags: + - v0.* + - v1 + - v1.* + paths-ignore: + - 'README.md' + - '.github/**' + - '.gitignore' + pull_request: + branches: [ master ] + paths-ignore: + - 'README.md' + - '.github/**' + - '.gitignore' + +jobs: + + build: + strategy: + matrix: + platform: [ubuntu-latest, macos-latest, windows-latest] + name: Build + runs-on: ${{ matrix.platform }} + 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 + + - name: Get Short SHA8 + id: vars + run: | + echo "::set-output name=sha_short::$(git rev-parse --short=8 ${{ github.sha }})" + + - name: Get dependencies + run: go get -v -t -d ./... + + - name: Build + run: go build -v . + + - name: Upload Artifacts + if: matrix.platform == 'macos-latest' + uses: actions/upload-artifact@v1.0.0 + id: macos_build + with: + name: boom-bot-${{ matrix.platform }}-${{ steps.vars.outputs.sha_short }} + path: boom-bot + + - name: Upload Artifacts + if: matrix.platform == 'windows-latest' + uses: actions/upload-artifact@v1.0.0 + id: windows_build + with: + SHA8: + name: boom-bot-${{ matrix.platform }}-${{ steps.vars.outputs.sha_short }} + path: boom-bot.exe + + - name: Upload Artifacts + if: matrix.platform == 'ubuntu-latest' + id: ubuntu_build + uses: actions/upload-artifact@v1.0.0 + with: + name: boom-bot-${{ matrix.platform }}-${{ steps.vars.outputs.sha_short }} + path: boom-bot + + - name: Publish Docker Image + if: success() && matrix.platform == 'ubuntu-latest' + id: upload_docker + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: haukeness/boom-bot + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + tag_semver: true