Skip to content

Commit dcac13f

Browse files
authored
build: document and script release steps (#5483)
1 parent 72a7419 commit dcac13f

File tree

3 files changed

+54
-13
lines changed

3 files changed

+54
-13
lines changed

.goreleaser.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,14 @@ builds:
1717
- linux
1818
- windows
1919
goarch:
20-
- "386"
2120
- amd64
22-
- arm
2321
- arm64
24-
ignore:
25-
- goarch: "386"
26-
goos: darwin
27-
- goarch: arm
28-
goos: windows
29-
- goarch: arm64
30-
goos: freebsd
31-
- goarch: arm64
32-
goos: windows
3322
binary: "{{ .ProjectName }}_v{{ .Version }}"
23+
hooks:
24+
post:
25+
- cp terraform-registry-manifest.json dist/{{ .ProjectName }}_{{ .Version }}_manifest.json
3426
archives:
35-
- formats: [ 'zip' ]
27+
- formats: ["zip"]
3628
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
3729
checksum:
3830
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"
@@ -45,7 +37,7 @@ signs:
4537
args:
4638
- "--batch"
4739
- "--local-user"
48-
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
40+
- "{{ .Env.GPG_FINGERPRINT }}"
4941
- "--output"
5042
- "${signature}"
5143
- "--detach-sign"

RELEASING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Releasing
2+
3+
## GitHub (Recommended)
4+
5+
> [!NOTE]
6+
> Releasing with GitHub Actions is currently not usable due to the Golang build cache being larger than the available resources for the free runners. There is work to remedy this but in the meantime, you must follow the manual steps.
7+
8+
- Merge release PR.
9+
- If needed, trigger the resync Terraform registry releases CI job.
10+
11+
## Manual
12+
13+
> [!NOTE]
14+
> Depending on your local Go build cache, you may hit "out of disk space" issues in $TMP" errors. To workaround this, run the release script multiple times while the cache is rebuilt. The script is idempotent and is fine to be run multiple times to get all the artifacts.
15+
16+
- Merge GitHub release PR.
17+
- Load Terraform GPG key into local keychain.
18+
- Set the GPG fingerprint.
19+
```
20+
export GPG_FINGERPRINT="..."
21+
```
22+
- Ensure GoReleaser is installed.
23+
- Locally checkout the release tag.
24+
- Run `script/release`.
25+
- Open GitHub release and edit it.
26+
- Upload all binary archives, `terraform-provider-cloudflare_<version>_SHA256SUMS`, `terraform-provider-cloudflare_<version>_SHA256SUMS.sig` and `terraform-provider-cloudflare_<version>_manifest.json` to the GitHub release.
27+
- Trigger the resync Terraform registry releases CI job.

scripts/release

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
cd "$(dirname "$0")/.."
6+
7+
echo "==> Checking environment is correctly configured"
8+
if ! command -v goreleaser 2>&1 >/dev/null; then
9+
echo "goreleaser is not installed."
10+
exit 1
11+
fi
12+
13+
if [ -z "${GPG_FINGERPRINT}" ]; then
14+
echo "GPG_FINGERPRINT not defined. You must export it before continuing."
15+
exit 1
16+
fi
17+
18+
echo "==> Running GoReleaser"
19+
# only use half of the available CPU to not starve other apps.
20+
cpu=$(sysctl -n hw.ncpu)
21+
usable_cpu=$(($cpu / 2))
22+
goreleaser release --clean --timeout 2h --skip "announce,publish" -p $usable_cpu

0 commit comments

Comments
 (0)