diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..62494f4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release + +on: + pull_request: + types: + - labeled + - closed + +jobs: + release-check: + runs-on: ubuntu-latest + if: github.event.action == 'labeled' + steps: + - uses: actions/checkout@v2 + # Bump version on merging Pull Requests with specific labels. + # (bump:major,bump:minor,bump:patch) + - uses: haya14busa/action-bumpr@v1 + pre-release: + runs-on: ubuntu-latest + if: github.event.action == 'closed' && github.event.pull_request.merged + outputs: + skip: ${{ steps.bumpr.outputs.skip }} + steps: + - uses: actions/checkout@v2 + - id: bumpr + uses: haya14busa/action-bumpr@v1 + with: + github_token: ${{ secrets.GH_TOKEN }} + release: + runs-on: ubuntu-latest + if: github.event.action == 'closed' && github.event.pull_request.merged + needs: pre-release + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.15 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + if: "!needs.pre-release.outputs.skip" + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}