From c55daec155949c8d7f51750f028d38a57c31b24a Mon Sep 17 00:00:00 2001 From: alldoami Date: Mon, 31 Jan 2022 14:43:08 -0800 Subject: [PATCH 1/6] feat: Release workflow with GH --- .github/workflows/release.yml | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..b30c0f6c49 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,64 @@ +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: Import GPG key + id: import_gpg + uses: hashicorp/ghaction-import-gpg@v2.1.0 + env: + # These secrets will need to be configured for the repository: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + PASSPHRASE: ${{ secrets.PASSPHRASE }} + + - 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 + if: ${{ steps.release.outputs.release_created }} + + - uses: actions/setup-go@v2 + with: + go-version: 1.17 + 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 }} \ No newline at end of file From 2b85009316eea7feab7899af4634b8296df07abf Mon Sep 17 00:00:00 2001 From: alldoami Date: Mon, 31 Jan 2022 14:59:55 -0800 Subject: [PATCH 2/6] new var name --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b30c0f6c49..8044ecd4ac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,7 +35,7 @@ jobs: env: # These secrets will need to be configured for the repository: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - PASSPHRASE: ${{ secrets.PASSPHRASE }} + PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - name: release please uses: google-github-actions/release-please-action@v3 From bf5c1a88e096878a068904907eb744926d658a1e Mon Sep 17 00:00:00 2001 From: alldoami Date: Mon, 31 Jan 2022 15:02:24 -0800 Subject: [PATCH 3/6] release weekly on Mondays at 11 --- .github/workflows/release.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8044ecd4ac..345c0ef06c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,6 @@ on: - push: - branches: - - main + schedule: + - cron: '0 11 * * 1' name: release-please jobs: From be00387b4c4671069d8acda74d1fc4cca6857cc0 Mon Sep 17 00:00:00 2001 From: alldoami Date: Mon, 31 Jan 2022 15:04:42 -0800 Subject: [PATCH 4/6] add gpg env var --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 345c0ef06c..49dc252209 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,4 +60,5 @@ jobs: args: release --rm-dist env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} if: ${{ steps.release.outputs.release_created }} \ No newline at end of file From dbd1594bc49075e01d173407b4311408071cd799 Mon Sep 17 00:00:00 2001 From: alldoami Date: Mon, 31 Jan 2022 15:05:30 -0800 Subject: [PATCH 5/6] newline --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 49dc252209..b88fc5a9a3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,4 +61,4 @@ jobs: env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} - if: ${{ steps.release.outputs.release_created }} \ No newline at end of file + if: ${{ steps.release.outputs.release_created }} From 501b978f837751586ddca51f6422bba6163353ef Mon Sep 17 00:00:00 2001 From: alldoami Date: Mon, 31 Jan 2022 15:31:08 -0800 Subject: [PATCH 6/6] on main --- .github/workflows/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b88fc5a9a3..0c9dd6255a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,7 @@ on: - schedule: - - cron: '0 11 * * 1' + push: + branches: + - main name: release-please jobs: