From ecd5845045c696324c09d05c2f3a359f65b727be Mon Sep 17 00:00:00 2001 From: Adam Shannon Date: Tue, 7 Jul 2020 13:29:11 -0500 Subject: [PATCH] build: setup Actions release job --- .github/workflows/release.yml | 150 ++++++++++++++++++++++++++++++++++ .travis.yml | 34 -------- 2 files changed, 150 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..69c6fbf6d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,150 @@ +name: Create Release + +on: + push: + tags: [ "v*.*.*" ] + +jobs: + testing: + name: Testing + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.14 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Check + run: make check + + create_release: + name: Create Release + needs: [testing] + runs-on: ubuntu-latest + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + prerelease: true + + - name: Output Release URL File + run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt + + - name: Save Release URL File for publish + uses: actions/upload-artifact@v1 + with: + name: release_url + path: release_url.txt + + publish: + name: Publish + needs: [testing, create_release] + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.14 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Load Release URL File from release job + uses: actions/download-artifact@v1 + with: + name: release_url + + - name: Distribute + run: make dist + + - name: Get Release File Name & Upload URL + id: get_release_info + shell: bash + run: | + value=`cat release_url/release_url.txt` + echo ::set-output name=upload_url::$value + env: + TAG_REF_NAME: ${{ github.ref }} + REPOSITORY_NAME: ${{ github.repository }} + + - name: Upload Linux Binary + if: runner.os == 'Linux' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_info.outputs.upload_url }} + asset_path: ./bin/paygate-linux-amd64 + asset_name: paygate-linux-amd64 + asset_content_type: application/octet-stream + + - name: Upload macOS Binary + if: runner.os == 'macOS' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_info.outputs.upload_url }} + asset_path: ./bin/paygate-darwin-amd64 + asset_name: paygate-darwin-amd64 + asset_content_type: application/octet-stream + + - name: Upload Windows Binary + if: runner.os == 'Windows' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_info.outputs.upload_url }} + asset_path: ./bin/paygate.exe + asset_name: paygate.exe + asset_content_type: application/octet-stream + + docker: + name: Docker + needs: [testing, create_release] + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.14 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Docker + run: make docker + + - name: Docker Push + run: |+ + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + make release-push + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + + # - name: Quay.io Push + # run: |+ + # echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin quay.io + # make quay-push + # env: + # DOCKER_USERNAME: ${{ secrets.QUAY_USERNAME }} + # DOCKER_PASSWORD: ${{ secrets.QUAY_PASSWORD }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d32dcd209..000000000 --- a/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ -language: go -dist: xenial -sudo: true -services: [docker] - -matrix: - include: - - os: linux - go: 1.14.x - -before_deploy: - - make dist - -deploy: - provider: releases - api_key: - secure: JaZPNf9Er+wCWwqgfGQowRL8/FZ8FZ4I1CI65ZI16j0HuSxUSdl4ygOeF8SNZ3UMecC8OlRhyuyxIEfoFpxjKvKL7fNyCJCfDGIY/icqmbNoTZitaJwF2QkYQ97U8gtAi1951kcI5A118Ynd/6jKCyYjEhhnlVMJwVuk723A0qWgRFzVekoMWuc+wo4diCrAjVXKvwivJn2CpAYkMlTpQTZgAQm4XbnHtnoB/sR7uDmJpeiOjShfFtYfOTsrqINJND+3bdPTySkPO4MaZ8yB+esdF69URSWOsGhdJf7O0m+494mQjeMdmqyAj0XD7D6NW0253N7oh2ikSa1Cq0xJ1zvUFMnvu3DVlQkEmF+G9pB+C+x0lbxmhO4UelX9wETnohRjZvxqQACZhZrTsh4B+AdGKM1kZkBXpm38aT0U80w7ICczg952is04ZX1YBXXl4m3tWd6MlN3hEdzDaPMj57Rg9v+SyslCLYPQfi0uP1fSc/gjYHogY8UvSLI8R+H7ri71pe/ACoJ/tew6Z6oKyHAigivTBXcGWcDOSWP2DfLBdSrqsKtnDJPiieyINsqzTY1xsHggSTj7bW4PGetg7Yudmf1LB4/A5W5cOTSdhMB4NZh14dbASL/l7eHeZhXGng3XWLX1dBu3h4dsTIm+Mnj/YCbYXFprk4IHzLjADYM= - file_glob: true - file: - - bin/paygate-* - - bin/paygate.exe - on: - repo: moov-io/paygate - tags: true - go: 1.14.x - skip_cleanup: true - -after_deploy: - - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - - make release-push - -notifications: - slack: - secure: ZJwRHo5yVXMyJ3p4aTM9dQj3NGnrnUoue2bTdTL5W0pHfy+wmqF/ccbTmZrMdNRSaofmLjQ1MS2hnAj3COYZJt+EN3VKG9WCJ8Pcvr6kl6Lmne2f27iGJUTmmQM/ngW4katjTy+BOE3ON5tloa+ixw06jQi/mNLEptj8He49QQDvbTkfP9xrNwMVXqyAEz8AooYHhT3HNc9YpNXnaH703XhHa19R5Kpdolkg5wgVoAGCYJ6PgBBSRfBvXtCqbThVmsean1yZuaXqxjj8WboQ/yiSt8g4cz0+qVsRWa2nvYn3DgP+0cVK4TXJNJ5ruPPpkjIOBye/Zl2ww2qO9OWQxZ1XiFln4sJH6GpZrgT/DsiUJbqcgmNELhDWSY96vEqrEpGAG3uDiTubqO1G3iRGwep6kcIoTPlCouJBRm5mLhdTk/kQazqxkfLn3bamLw+a5rN3UHYeq3s0VAxzDhmziZFBAQCH3OF2+Se7mjyW9w4t7opMF5texXknbluzJR0OVHjjIxj+po4aIpuS6wpQ97jtg3PbQnTE8ogxW8JdTlpG1PVuWh3HwzyMa33qILyx0AFgV9z668O9u0HiF2Xosjx7gBl/bvVJP3XMCZFtc3NHT8Ahz7UOoq7vlI1zumo1KkdPdioJvcfDg121u21/6pohuI1tKzNrVvesppDnN9Y=