|
1 | 1 | name: Release
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - tags: |
6 |
| - - 'v[0-9]+.[0-9]+.[0-9]+*' |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + versionNumber: |
| 7 | + description: 'Release version number (v#.#.#)' |
| 8 | + type: string |
| 9 | + required: true |
| 10 | + |
| 11 | +env: |
| 12 | + CI_COMMIT_AUTHOR: hc-github-team-tf-provider-devex |
| 13 | + CI_COMMIT_EMAIL: [email protected] |
7 | 14 |
|
8 | 15 | permissions:
|
9 | 16 | contents: write
|
10 | 17 |
|
11 | 18 | jobs:
|
| 19 | + changelog-version: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + outputs: |
| 22 | + version: ${{ steps.changelog-version.outputs.version }} |
| 23 | + steps: |
| 24 | + - id: changelog-version |
| 25 | + run: echo "version=$(echo "${{ inputs.versionNumber }}" | cut -c 2-)" >> "$GITHUB_OUTPUT" |
| 26 | + changelog: |
| 27 | + needs: changelog-version |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 |
| 32 | + with: |
| 33 | + fetch-depth: 0 |
| 34 | + - name: Batch changes |
| 35 | + uses: miniscruff/changie-action@7d8e4c245da691d57ca34019a0504321fa7b7e07 # v1.0.0 |
| 36 | + with: |
| 37 | + version: latest |
| 38 | + args: batch ${{ needs.changelog-version.outputs.version }} |
| 39 | + env: |
| 40 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + - name: Merge changes |
| 42 | + uses: miniscruff/changie-action@7d8e4c245da691d57ca34019a0504321fa7b7e07 # v1.0.0 |
| 43 | + with: |
| 44 | + version: latest |
| 45 | + args: merge |
| 46 | + env: |
| 47 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 48 | + - name: Git push changelog |
| 49 | + run: | |
| 50 | + git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" |
| 51 | + git config --global user.email "${{ env.CI_COMMIT_EMAIL }}" |
| 52 | + git add . |
| 53 | + git commit -a -m "Update changelog" |
| 54 | + git push |
| 55 | + release-tag: |
| 56 | + needs: changelog |
| 57 | + runs-on: ubuntu-latest |
| 58 | + steps: |
| 59 | + - name: Checkout |
| 60 | + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 |
| 61 | + with: |
| 62 | + fetch-depth: 0 |
| 63 | + - name: Git push release tag |
| 64 | + run: | |
| 65 | + git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" |
| 66 | + git config --global user.email "${{ env.CI_COMMIT_EMAIL }}" |
| 67 | + git pull |
| 68 | + git tag "${{ inputs.versionNumber }}" |
| 69 | + git push origin "${{ inputs.versionNumber }}" |
12 | 70 | release-notes:
|
| 71 | + needs: [ changelog-version, changelog, release-tag ] |
13 | 72 | runs-on: ubuntu-latest
|
14 | 73 | steps:
|
15 | 74 | - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
16 | 75 | with:
|
| 76 | + ref: ${{ inputs.versionNumber }} |
17 | 77 | fetch-depth: 0
|
18 | 78 | - name: Generate Release Notes
|
19 |
| - run: sed -n -e "1{/# /d;}" -e "2{/^$/d;}" -e "/# $(git describe --abbrev=0 --exclude="$(git describe --abbrev=0 --match='v*.*.*' --tags)" --match='v*.*.*' --tags | tr -d v)/q;p" CHANGELOG.md > release-notes.txt |
| 79 | + run: | |
| 80 | + cd .changes |
| 81 | + sed -e "1{/# /d;}" -e "2{/^$/d;}" ${{ needs.changelog-version.outputs.version }}.md > release-notes.txt |
20 | 82 | - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
|
21 | 83 | with:
|
22 | 84 | name: release-notes
|
23 |
| - path: release-notes.txt |
| 85 | + path: ./.changes/release-notes.txt |
24 | 86 | retention-days: 1
|
25 | 87 | terraform-provider-release:
|
26 | 88 | name: 'Terraform Provider Release'
|
27 |
| - needs: [release-notes] |
| 89 | + needs: [ release-notes ] |
28 | 90 | uses: hashicorp/ghaction-terraform-provider-release/.github/workflows/hashicorp.yml@106e6d08159ccec423310cc2c706bae59f46c09c # v2.2.0
|
29 | 91 | secrets:
|
30 |
| - hc-releases-github-token: '${{ secrets.HASHI_RELEASES_GITHUB_TOKEN }}' |
31 |
| - hc-releases-host-staging: '${{ secrets.HC_RELEASES_HOST_STAGING }}' |
32 |
| - hc-releases-host-prod: '${{ secrets.HC_RELEASES_HOST_PROD }}' |
33 | 92 | hc-releases-key-prod: '${{ secrets.HC_RELEASES_KEY_PROD }}'
|
34 | 93 | hc-releases-key-staging: '${{ secrets.HC_RELEASES_KEY_STAGING }}'
|
| 94 | + hc-releases-github-token: '${{ secrets.HASHI_RELEASES_GITHUB_TOKEN }}' |
35 | 95 | hc-releases-terraform-registry-sync-token: '${{ secrets.TF_PROVIDER_RELEASE_TERRAFORM_REGISTRY_SYNC_TOKEN }}'
|
36 | 96 | setup-signore-github-token: '${{ secrets.HASHI_SIGNORE_GITHUB_TOKEN }}'
|
37 | 97 | signore-client-id: '${{ secrets.SIGNORE_CLIENT_ID }}'
|
38 | 98 | signore-client-secret: '${{ secrets.SIGNORE_CLIENT_SECRET }}'
|
| 99 | + hc-releases-host-staging: '${{ secrets.HC_RELEASES_HOST_STAGING }}' |
| 100 | + hc-releases-host-prod: '${{ secrets.HC_RELEASES_HOST_PROD }}' |
39 | 101 | with:
|
40 | 102 | release-notes: true
|
41 | 103 | setup-go-version-file: 'go.mod'
|
42 |
| - # Product Version (e.g. v1.2.3 or github.ref_name) |
43 |
| - product-version: '${{ github.ref_name }}' |
| 104 | + # Product Version (e.g. v1.2.3) |
| 105 | + product-version: '${{ inputs.versionNumber }}' |
0 commit comments