|
1 | | -# This GitHub action can publish assets for release when a tag is created. |
2 | | -# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0). |
3 | | -# |
4 | | -# This uses an action (paultyng/ghaction-import-gpg) that assumes you set your |
5 | | -# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE` |
6 | | -# secret. If you would rather own your own GPG handling, please fork this action |
7 | | -# or use an alternative one for key handling. |
8 | | -# |
9 | | -# You will need to pass the `--batch` flag to `gpg` in your signing step |
10 | | -# in `goreleaser` to indicate this is being used in a non-interactive mode. |
11 | | -# |
12 | | -name: release |
| 1 | +name: Release |
13 | 2 | on: |
14 | | - push: |
15 | | - tags: |
16 | | - - 'v*' |
17 | | - |
| 3 | + release: |
| 4 | + types: [published] |
18 | 5 | jobs: |
19 | | - goreleaser: |
| 6 | + release: |
20 | 7 | runs-on: ubuntu-latest |
21 | 8 | steps: |
22 | | - - name: Checkout |
23 | | - uses: actions/checkout@v2 |
24 | | - |
25 | | - - name: Unshallow |
26 | | - run: git fetch --prune --unshallow |
27 | | - |
28 | | - - name: Set up Go |
29 | | - uses: actions/setup-go@v2 |
| 9 | + - uses: actions/checkout@v2 |
| 10 | + - uses: actions/setup-go@v2 |
30 | 11 | with: |
31 | | - go-version: 1.16 |
32 | | - |
33 | | - - name: Import GPG key |
34 | | - id: import_gpg |
35 | | - uses: paultyng/ghaction-import-gpg@v2.1.0 |
| 12 | + go-version: 1.17 |
| 13 | + - uses: paultyng/ghaction-import-gpg@v2.1.0 |
36 | 14 | env: |
37 | 15 | GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} |
38 | 16 | PASSPHRASE: ${{ secrets.PASSPHRASE }} |
39 | | - |
40 | | - - name: Run GoReleaser |
41 | | - uses: goreleaser/goreleaser-action@v2 |
| 17 | + id: import_gpg |
| 18 | + - uses: goreleaser/goreleaser-action@v2 |
42 | 19 | with: |
43 | 20 | version: latest |
44 | 21 | args: release --rm-dist |
45 | 22 | env: |
46 | 23 | GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |
47 | 24 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 25 | + synchronize: |
| 26 | + # Empyrically equivalent to pressing the "Resync" button in the Settings |
| 27 | + # page of Terraform Registry, but without bothering humans in the process |
| 28 | + # https://registry.terraform.io/providers/iterative/iterative/latest/settings |
| 29 | + # https://www.terraform.io/docs/registry/providers/publishing.html#webhooks |
| 30 | + needs: release |
| 31 | + runs-on: ubuntu-latest |
| 32 | + timeout-minutes: 15 |
| 33 | + steps: |
| 34 | + - uses: hashicorp/setup-terraform@v1 |
| 35 | + - run: | |
| 36 | + cat <<END > main.tf |
| 37 | + terraform { |
| 38 | + required_providers { |
| 39 | + iterative = { |
| 40 | + source = "iterative/iterative", |
| 41 | + version = "${GITHUB_REF##refs/tags/v}" |
| 42 | + } |
| 43 | + } |
| 44 | + } |
| 45 | + provider "iterative" {} |
| 46 | + END |
| 47 | + - run: | |
| 48 | + while ! terraform init; do |
| 49 | + sleep $((2**++try)) |
| 50 | + done |
0 commit comments