Skip to content

Commit

Permalink
Merge f98b797 into d9df511
Browse files Browse the repository at this point in the history
  • Loading branch information
weilueluo authored Oct 30, 2023
2 parents d9df511 + f98b797 commit d7108b7
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 30 deletions.
40 changes: 10 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
push:
branches:
- 'main'
- 'LH-70847-fix-release-trigger'
tags:
- 'v*'
env:
Expand Down Expand Up @@ -95,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
Expand Down Expand Up @@ -129,9 +130,10 @@ 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'
# if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout repository code
Expand All @@ -140,31 +142,9 @@ jobs:
uses: mathieudutour/[email protected]
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 }}
name: "Release"
needs: [tag-release-version]
uses: ./.github/workflows/module-release.yml
secrets: inherit
10 changes: 10 additions & 0 deletions .github/workflows/manual-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
on:
push:
tags:
- 'v**'

jobs:
release:
name: "Release"
uses: ./.github/workflows/module-release.yml
secrets: inherit
38 changes: 38 additions & 0 deletions .github/workflows/module-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release
on:
workflow_call:

env:
AWS_REGION: "us-west-2"

permissions:
contents: write

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 }}

0 comments on commit d7108b7

Please sign in to comment.