From c2ff4ba2c2a11cf38410d63f5ad7518bff85e295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Pi=C3=B1a?= Date: Sun, 6 Sep 2020 16:28:16 -0700 Subject: [PATCH] Add release workflow --- .github/workflows/release.yaml | 79 +++++++++++++++++++++ .github/workflows/{go.yaml => testing.yaml} | 6 +- 2 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yaml rename .github/workflows/{go.yaml => testing.yaml} (91%) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..2f355668 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,79 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + release_darwin: + name: Release Darwin + runs-on: macos-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Create tarball + run: | + make release/noti.darwinrelease + - name: Set tag env var + run: echo ::set-env name=GIT_TAG::${GITHUB_REF#refs/*/} + - name: Stash release + uses: actions/upload-artifact@v2 + with: + name: noti.darwinrelease + path: release/noti.darwinrelease + release: + needs: release_darwin + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Create release draft + id: create_release_draft + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + tag_name: ${{github.ref}} + release_name: ${{github.ref}} + draft: true + prerelease: false + - name: Set tag env var + run: echo ::set-env name=GIT_TAG::${GITHUB_REF#refs/*/} + - name: Download Darwin release + uses: actions/download-artifact@v2 + with: + name: noti.darwinrelease + path: release + - name: Create tarballs + run: | + make release + make release-darwin + - name: Upload Linux + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + upload_url: ${{steps.create_release_draft.outputs.upload_url}} + asset_path: ./release/noti${{env.GIT_TAG}}.linux-amd64.tar.gz + asset_name: noti${{env.GIT_TAG}}.linux-amd64.tar.gz + asset_content_type: application/gzip; charset=binary + - name: Upload Darwin + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + upload_url: ${{steps.create_release_draft.outputs.upload_url}} + asset_path: ./release/noti${{env.GIT_TAG}}.darwin-amd64.tar.gz + asset_name: noti${{env.GIT_TAG}}.darwin-amd64.tar.gz + asset_content_type: application/gzip; charset=binary + - name: Upload Windows + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + upload_url: ${{steps.create_release_draft.outputs.upload_url}} + asset_path: ./release/noti${{env.GIT_TAG}}.windows-amd64.tar.gz + asset_name: noti${{env.GIT_TAG}}.windows-amd64.tar.gz + asset_content_type: application/gzip; charset=binary diff --git a/.github/workflows/go.yaml b/.github/workflows/testing.yaml similarity index 91% rename from .github/workflows/go.yaml rename to .github/workflows/testing.yaml index 19ee5a5c..9b529a8a 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/testing.yaml @@ -1,7 +1,9 @@ -name: Go +name: Testing + on: - push - pull_request + jobs: build: name: CI Job @@ -11,7 +13,7 @@ jobs: - macos-10.15 - ubuntu-18.04 - windows-2019 - runs-on: ${{ matrix.os }} + runs-on: ${{matrix.os}} steps: - name: Setup Go id: setup-go