From ee2ec334aaa61d505ba6777d1d4c308907cd4434 Mon Sep 17 00:00:00 2001 From: Eduardo Lopez <3452666+edulop91@users.noreply.github.com> Date: Wed, 3 Aug 2022 15:57:42 -0400 Subject: [PATCH] feat: release github action --- .github/workflows/release.yaml | 62 ++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..d3206fb --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,62 @@ +on: + push: + branches: + - main + +name: release-please +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v5 + id: configure-changelog + with: + result-encoding: string + script: | + const changelogTypes = [ + {type: "feat", section: "Features", hidden: false}, + {type: "chore", section: "Misc", hidden: false}, + {type: "fix", section: "BugFixes", hidden: false}, + ] + + return JSON.stringify(changelogTypes) + + # See https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow + # For why we need to generate a token and not use the default + - name: Generate token + id: generate_token + uses: chanzuckerberg/github-app-token@v1.1.4 + with: + app_id: ${{ secrets.CZI_RELEASE_PLEASE_APP_ID }} + private_key: ${{ secrets.CZI_RELEASE_PLEASE_PK }} + + - name: release please + uses: google-github-actions/release-please-action@v3 + id: release + with: + release-type: simple + bump-minor-pre-major: true + changelog-types: ${{ steps.configure-changelog.outputs.result }} + token: ${{ steps.generate_token.outputs.token }} + + - uses: actions/checkout@v2 + # we need to fetch all history and tags, + # so we build the proper version + with: + fetch-depth: 0 + if: ${{ steps.release.outputs.release_created }} + + - uses: actions/setup-go@v2 + with: + go-version: 1.18 + if: ${{ steps.release.outputs.release_created }} + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} + if: ${{ steps.release.outputs.release_created }} + outputs: + release_created: ${{ steps.release.outputs.release_created }}