From 7ddbe0023e5097c47387f92f76234fdc99cd8878 Mon Sep 17 00:00:00 2001 From: Weilue Luo <weilluo@cisco.com> Date: Mon, 30 Oct 2023 17:33:05 +0000 Subject: [PATCH 1/9] fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36ff205c..9010fd2e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -130,7 +130,7 @@ jobs: run: go test -v -cover ./... timeout-minutes: 10 trigger-release: - needs: [acceptance-tests, unit-test] + needs: [acceptance-test, unit-test] if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: From 17707d3c581d94d96f16759646a3525d1c2a146d Mon Sep 17 00:00:00 2001 From: Weilue Luo <weilluo@cisco.com> Date: Mon, 30 Oct 2023 19:39:22 +0000 Subject: [PATCH 2/9] fix --- .github/workflows/ci.yml | 34 +++++---------------------- .github/workflows/manual-release.yml | 9 +++++++ .github/workflows/modules/release.yml | 32 +++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/manual-release.yml create mode 100644 .github/workflows/modules/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9010fd2e..151635fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -129,7 +129,8 @@ jobs: ASA_RESOURCE_SDC_PASSWORD: ${{ secrets.ASA_RESOURCE_SDC_PASSWORD }} run: go test -v -cover ./... timeout-minutes: 10 - trigger-release: + tag-release-version: + name: "Tag Release Version" needs: [acceptance-test, unit-test] if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest @@ -140,31 +141,8 @@ jobs: uses: mathieudutour/github-tag-action@v6.1 with: github_token: ${{ secrets.GITHUB_TOKEN }} + # we cannot trigger workflow using above's tagging, so we need to do it manually release: - if: github.ref_type == 'tag' - runs-on: ubuntu-latest - needs: [unit-test] - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - # Allow goreleaser to access older tag information. - fetch-depth: 0 - - uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 - with: - go-version: '1.20' - cache: true - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # v6.0.0 - id: import_gpg - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.PASSPHRASE }} - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0 - with: - args: release --clean - workdir: provider - env: - # GitHub sets the GITHUB_TOKEN secret automatically. - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} \ No newline at end of file + name: "Release" + needs: [tag-release-version] + uses: ./.github/workflows/modules/release.yml@main \ No newline at end of file diff --git a/.github/workflows/manual-release.yml b/.github/workflows/manual-release.yml new file mode 100644 index 00000000..25bb7d74 --- /dev/null +++ b/.github/workflows/manual-release.yml @@ -0,0 +1,9 @@ +on: + push: + tags: + - 'v**' + +jobs: + release: + name: "Release" + uses: ./.github/workflows/modules/release.yml@main diff --git a/.github/workflows/modules/release.yml b/.github/workflows/modules/release.yml new file mode 100644 index 00000000..feb28c25 --- /dev/null +++ b/.github/workflows/modules/release.yml @@ -0,0 +1,32 @@ +name: Release +on: + workflow_call: + +jobs: + release: + name: "Release" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + with: + # Allow goreleaser to access older tag information. + fetch-depth: 0 + - uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 + with: + go-version: '1.20' + cache: true + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # v6.0.0 + id: import_gpg + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.PASSPHRASE }} + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0 + with: + args: release --clean + workdir: provider + env: + # GitHub sets the GITHUB_TOKEN secret automatically. + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} \ No newline at end of file From 7123dd26841b4889269ba9809824d75b6beaabb2 Mon Sep 17 00:00:00 2001 From: Weilue Luo <weilluo@cisco.com> Date: Mon, 30 Oct 2023 19:44:18 +0000 Subject: [PATCH 3/9] fix --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 151635fa..2b1d5e75 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ on: push: branches: - 'main' + - 'LH-70847-fix-release-trigger' tags: - 'v*' env: From 28974a5cabcb4ae97d6a1465911d0fed4891195d Mon Sep 17 00:00:00 2001 From: Weilue Luo <weilluo@cisco.com> Date: Mon, 30 Oct 2023 19:46:18 +0000 Subject: [PATCH 4/9] tets --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b1d5e75..44adb2d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,7 +96,7 @@ jobs: name: Terraform Provider Acceptance Tests needs: unit-test runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' +# if: github.ref == 'refs/heads/main' defaults: run: working-directory: provider From 10d56e5db77b99670bf0f21df4671527a25176a2 Mon Sep 17 00:00:00 2001 From: Weilue Luo <weilluo@cisco.com> Date: Mon, 30 Oct 2023 19:48:32 +0000 Subject: [PATCH 5/9] test --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44adb2d6..ebb056a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ on: push: branches: - 'main' - - 'LH-70847-fix-release-trigger' + - 'refs/heads/LH-70847-fix-release-trigger' tags: - 'v*' env: @@ -133,7 +133,7 @@ jobs: tag-release-version: name: "Tag Release Version" needs: [acceptance-test, unit-test] - if: github.ref == 'refs/heads/main' +# if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - name: Checkout repository code From bba8bdb0b4cea628f3d135cdd62afeb537e3d8df Mon Sep 17 00:00:00 2001 From: Weilue Luo <weilluo@cisco.com> Date: Mon, 30 Oct 2023 19:50:50 +0000 Subject: [PATCH 6/9] test --- .github/workflows/ci.yml | 4 ++-- .github/workflows/manual-release.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebb056a6..152515d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ on: push: branches: - 'main' - - 'refs/heads/LH-70847-fix-release-trigger' + - 'LH-70847-fix-release-trigger' tags: - 'v*' env: @@ -146,4 +146,4 @@ jobs: release: name: "Release" needs: [tag-release-version] - uses: ./.github/workflows/modules/release.yml@main \ No newline at end of file + uses: ./.github/workflows/modules/release.yml \ No newline at end of file diff --git a/.github/workflows/manual-release.yml b/.github/workflows/manual-release.yml index 25bb7d74..f464ff87 100644 --- a/.github/workflows/manual-release.yml +++ b/.github/workflows/manual-release.yml @@ -6,4 +6,4 @@ on: jobs: release: name: "Release" - uses: ./.github/workflows/modules/release.yml@main + uses: ./.github/workflows/modules/release.yml From 96fddbe2f367fdcf270fcb1f53a9322c0488e9fc Mon Sep 17 00:00:00 2001 From: Weilue Luo <weilluo@cisco.com> Date: Mon, 30 Oct 2023 19:51:58 +0000 Subject: [PATCH 7/9] test --- .github/workflows/ci.yml | 2 +- .github/workflows/manual-release.yml | 2 +- .github/workflows/{modules/release.yml => module-release.yml} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{modules/release.yml => module-release.yml} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 152515d0..cc2a385f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -146,4 +146,4 @@ jobs: release: name: "Release" needs: [tag-release-version] - uses: ./.github/workflows/modules/release.yml \ No newline at end of file + uses: ./.github/workflows/module-release.yml \ No newline at end of file diff --git a/.github/workflows/manual-release.yml b/.github/workflows/manual-release.yml index f464ff87..6a230ccc 100644 --- a/.github/workflows/manual-release.yml +++ b/.github/workflows/manual-release.yml @@ -6,4 +6,4 @@ on: jobs: release: name: "Release" - uses: ./.github/workflows/modules/release.yml + uses: ./.github/workflows/module-release.yml diff --git a/.github/workflows/modules/release.yml b/.github/workflows/module-release.yml similarity index 100% rename from .github/workflows/modules/release.yml rename to .github/workflows/module-release.yml From e821e67c77824ea1b2d4d99a91826e480c7d860a Mon Sep 17 00:00:00 2001 From: Weilue Luo <weilluo@cisco.com> Date: Mon, 30 Oct 2023 20:44:41 +0000 Subject: [PATCH 8/9] test --- .github/workflows/module-release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/module-release.yml b/.github/workflows/module-release.yml index feb28c25..229bcde5 100644 --- a/.github/workflows/module-release.yml +++ b/.github/workflows/module-release.yml @@ -2,6 +2,9 @@ name: Release on: workflow_call: +env: + AWS_REGION: "us-west-2" + jobs: release: name: "Release" From f98b797e7239ab39d6ed431c2e3d291022abe3a3 Mon Sep 17 00:00:00 2001 From: Weilue Luo <weilluo@cisco.com> Date: Mon, 30 Oct 2023 21:03:10 +0000 Subject: [PATCH 9/9] test --- .github/workflows/ci.yml | 3 ++- .github/workflows/manual-release.yml | 1 + .github/workflows/module-release.yml | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc2a385f..9d5a2da7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -146,4 +146,5 @@ jobs: release: name: "Release" needs: [tag-release-version] - uses: ./.github/workflows/module-release.yml \ No newline at end of file + uses: ./.github/workflows/module-release.yml + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/manual-release.yml b/.github/workflows/manual-release.yml index 6a230ccc..6a672315 100644 --- a/.github/workflows/manual-release.yml +++ b/.github/workflows/manual-release.yml @@ -7,3 +7,4 @@ jobs: release: name: "Release" uses: ./.github/workflows/module-release.yml + secrets: inherit diff --git a/.github/workflows/module-release.yml b/.github/workflows/module-release.yml index 229bcde5..d3e56064 100644 --- a/.github/workflows/module-release.yml +++ b/.github/workflows/module-release.yml @@ -5,6 +5,9 @@ on: env: AWS_REGION: "us-west-2" +permissions: + contents: write + jobs: release: name: "Release"