From 2f045ebe3cf41ef02e8aacebec0b6d2e5d8b7d66 Mon Sep 17 00:00:00 2001 From: Aastha Mahendru Date: Wed, 20 Mar 2024 11:22:33 +0000 Subject: [PATCH 1/3] update release to use existing tag if required --- .github/workflows/release.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 84c9dda952..0e10e0b878 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,6 +10,8 @@ on: required: true skip_tests: description: 'Skip QA acceptance tests, define value to `true` to explicitly skip' + use_existing_tag: + description: 'Set value to `true` to use an existing tag for this release version, default is `false`' jobs: @@ -28,6 +30,7 @@ jobs: uses: ./.github/workflows/acceptance-tests.yml with: atlas_cloud_env: "qa" + ref: ${{ inputs.use_existing_tag == 'true' && inputs.version_number }} release: runs-on: ubuntu-latest @@ -36,14 +39,17 @@ jobs: steps: - name: Checkout uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + with: + ref: ${{ inputs.use_existing_tag == 'true' && inputs.version_number || github.ref }} - name: Unshallow run: git fetch --prune --unshallow - name: Create release tag - uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72 # will fail if existing tag is present + uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72 with: tag: ${{ inputs.version_number }} gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} gpg_passphrase: ${{ secrets.PASSPHRASE }} + tag_exists_error: ${{ inputs.use_existing_tag == 'true' && false || true }} - name: Set up Go uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 with: From 18a01570b087435481e14e60cab18713d46e7d73 Mon Sep 17 00:00:00 2001 From: Aastha Mahendru Date: Thu, 21 Mar 2024 12:36:46 +0000 Subject: [PATCH 2/3] address PR comments --- .github/workflows/release.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0e10e0b878..770f8aacd4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,7 +30,7 @@ jobs: uses: ./.github/workflows/acceptance-tests.yml with: atlas_cloud_env: "qa" - ref: ${{ inputs.use_existing_tag == 'true' && inputs.version_number }} + ref: ${{ inputs.use_existing_tag == 'true' && inputs.version_number || github.ref }} release: runs-on: ubuntu-latest @@ -49,7 +49,7 @@ jobs: tag: ${{ inputs.version_number }} gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} gpg_passphrase: ${{ secrets.PASSPHRASE }} - tag_exists_error: ${{ inputs.use_existing_tag == 'true' && false || true }} + tag_exists_error: ${{ inputs.use_existing_tag != 'true' }} - name: Set up Go uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 with: @@ -62,11 +62,11 @@ jobs: passphrase: ${{ secrets.PASSPHRASE }} - name: Set the user terminal run: export GPG_TTY=$(tty) - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 - with: - version: latest - args: release --rm-dist - env: - GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Run GoReleaser + # uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 + # with: + # version: latest + # args: release --rm-dist + # env: + # GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 66dcd02191027dd2112fba9e55b4403065c38a7f Mon Sep 17 00:00:00 2001 From: Aastha Mahendru Date: Thu, 21 Mar 2024 12:59:10 +0000 Subject: [PATCH 3/3] address PR comments --- .github/workflows/release.yml | 16 ++++++++-------- RELEASING.md | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 770f8aacd4..a7164badd9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -62,11 +62,11 @@ jobs: passphrase: ${{ secrets.PASSPHRASE }} - name: Set the user terminal run: export GPG_TTY=$(tty) - # - name: Run GoReleaser - # uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 - # with: - # version: latest - # args: release --rm-dist - # env: - # GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 + with: + version: latest + args: release --rm-dist + env: + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/RELEASING.md b/RELEASING.md index c9664cb847..983f2a1a5c 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -15,6 +15,7 @@ We pre-release the provider to make for testing purpose. **A Pre-release is not - Using our [Release GitHub Action](https://github.com/mongodb/terraform-provider-mongodbatlas/actions/workflows/release.yml) run a new workflow using `master` and the following inputs: - Version number: vX.Y.Z-pre - Skip QA acceptance tests: Should be left empty. Only used in case failing tests have been encountered in QA and the team agrees the release can still de done, or successful run of QA acceptance tests has already been done with the most recent changes. + - Using an existing tag: Should be left empty (default `false` creates a new tag from `master`). This should be set to `true` only if you want to re-use an existing tag for the release and the tag name should adhere to our version number format. - You will see the release in the [GitHub Release page](https://github.com/mongodb/terraform-provider-mongodbatlas/releases) once the [release action](.github/workflows/release.yml) has completed.