Skip to content

Commit 5ce1774

Browse files
authored
Improve release workflow (#285)
* Update release.yml * Update release.yml * Update release.yml * Update release.yml
1 parent dcce5a0 commit 5ce1774

File tree

1 file changed

+36
-33
lines changed

1 file changed

+36
-33
lines changed

.github/workflows/release.yml

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,50 @@
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
132
on:
14-
push:
15-
tags:
16-
- 'v*'
17-
3+
release:
4+
types: [published]
185
jobs:
19-
goreleaser:
6+
release:
207
runs-on: ubuntu-latest
218
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
3011
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
3614
env:
3715
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
3816
PASSPHRASE: ${{ secrets.PASSPHRASE }}
39-
40-
- name: Run GoReleaser
41-
uses: goreleaser/goreleaser-action@v2
17+
id: import_gpg
18+
- uses: goreleaser/goreleaser-action@v2
4219
with:
4320
version: latest
4421
args: release --rm-dist
4522
env:
4623
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
4724
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

Comments
 (0)