|
| 1 | +name: Autorelease |
| 2 | + |
| 3 | +# On each main branch push, bump version and publish a release |
| 4 | +"on": |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + |
| 9 | +# Releases need permissions to read and write the repository contents. |
| 10 | +# GitHub considers creating releases and uploading assets as writing contents. |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + autorelease: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + |
| 20 | + # Semver |
| 21 | + - name: Get Next Version |
| 22 | + id: semver |
| 23 | + uses: ietf-tools/semver-action@v1 |
| 24 | + with: |
| 25 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 26 | + branch: main |
| 27 | + skipInvalidTags: true |
| 28 | + patchList: ci,fix,bugfix,perf,refactor,test,tests |
| 29 | + - name: Create Release |
| 30 | + |
| 31 | + with: |
| 32 | + allowUpdates: true |
| 33 | + draft: false |
| 34 | + makeLatest: true |
| 35 | + name: ${{ steps.semver.outputs.next }} |
| 36 | + tag: ${{ steps.semver.outputs.next }} |
| 37 | + body: Update Terraform Provider with latest API changes |
| 38 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 39 | + |
| 40 | + |
| 41 | + # Re-run checkout to load the updated release tag |
| 42 | + - uses: actions/checkout@v4 |
| 43 | + with: |
| 44 | + fetch-depth: 0 |
| 45 | + |
| 46 | + # Goreleaser |
| 47 | + - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 |
| 48 | + with: |
| 49 | + go-version-file: 'go.mod' |
| 50 | + cache: true |
| 51 | + - name: Import GPG key |
| 52 | + uses: crazy-max/ghaction-import-gpg@111c56156bcc6918c056dbef52164cfa583dc549 # v5.2.0 |
| 53 | + id: import_gpg |
| 54 | + with: |
| 55 | + gpg_private_key: ${{ secrets.TERRAFORM_GPG_PRIVATE_KEY }} |
| 56 | + passphrase: ${{ secrets.TERRAFORM_GPG_PASSPHRASE }} |
| 57 | + - name: Run GoReleaser |
| 58 | + uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0 |
| 59 | + with: |
| 60 | + args: release --clean |
| 61 | + env: |
| 62 | + # GitHub sets the GITHUB_TOKEN secret automatically. |
| 63 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |
| 65 | + |
| 66 | + # Trigger gitlab pipeline |
| 67 | + - name: Trigger gitlab pipeline |
| 68 | + |
| 69 | + with: |
| 70 | + host: "https://gitlab.com" |
| 71 | + token: ${{ secrets.GITLAB_PROVIDERS_TOKEN }} |
| 72 | + project_id: 54648643 |
| 73 | + ref: providers |
| 74 | + |
0 commit comments