From ef3d502c4e18c20435e1f8fdfbce0845c82f6a3a Mon Sep 17 00:00:00 2001 From: Enrico Stahn Date: Wed, 4 Mar 2020 15:59:37 +1100 Subject: [PATCH] Update go.yml --- .github/workflows/go.yml | 54 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d03961e..03d64bc 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -7,13 +7,13 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go 1.14 + - name: Set up Go uses: actions/setup-go@v1 with: go-version: 1.14 id: go - - name: Check out code into the Go module directory + - name: Checkout uses: actions/checkout@v2 - name: Install golangci-lint @@ -33,8 +33,56 @@ jobs: go-version: 1.14 id: go - - name: Check out code into the Go module directory + - name: Checkout uses: actions/checkout@v2 - name: Test run: go test ./... + + tag: + name: Tag + runs-on: ubuntu-latest + needs: [lint, test] + if: github.ref == 'refs/heads/master' + steps: + + - name: Setup Node.js for use with actions + uses: actions/setup-node@v1.1.0 + + - name: Checkout + uses: actions/checkout@v2 + + - name: Unshallow + run: git fetch --prune --unshallow + + - name: Install semantic-release + run: yarn global add --no-progress --non-interactive "semantic-release" "@semantic-release/exec" + + - name: Run semantic-release + run: $(yarn global bin)/semantic-release + + release: + runs-on: ubuntu-latest + needs: [lint, test] + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Unshallow + run: git fetch --prune --unshallow + + - name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.14 + id: go + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --rm-dist + key: ${{ secrets.YOUR_PRIVATE_KEY }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}