Skip to content

Commit 92aa6d2

Browse files
committed
sign for macos with goreleaser + gon
1 parent c095ec4 commit 92aa6d2

File tree

6 files changed

+71
-2
lines changed

6 files changed

+71
-2
lines changed

.github/workflows/release.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ jobs:
2121
version: latest
2222
args: release --rm-dist
2323
env:
24-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

.gon.hcl

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
source = ["./dist/macos_darwin_amd64/terraform-credentials-keychain"]
2+
bundle_id = "com.bendrucker.terraform-credentials-keychain"
3+
4+
apple_id {
5+
username = "bvdrucker@gmail.com"
6+
}
7+
8+
sign {
9+
application_identity = "Developer ID Application: Benjamin V Drucker"
10+
}
11+
12+
zip {
13+
output_path = "./dist/macos_darwin_amd64/terraform-credentials-keychain.zip"
14+
}

.goreleaser.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
builds:
2+
- id: default
3+
goos:
4+
- linux
5+
- windows
6+
goarch:
7+
- amd64
8+
- id: macos
9+
goos:
10+
- darwin
11+
goarch:
12+
- amd64
13+
hooks:
14+
post: ./gon.sh {{.Path}} {{dir (dir .Path)}}/{{.ProjectName}}_{{.Version}}_{{.Target}}.zip
15+
archives:
16+
- builds:
17+
- default
18+
format_overrides:
19+
- goos: windows
20+
format: zip
21+
release:
22+
ids:
23+
- none
24+
extra_files:
25+
- glob: ./dist/*_darwin_amd64.zip

gon.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
set -euf -o pipefail
4+
5+
binary="$1"
6+
zip="$2"
7+
config="$(dirname "$binary")/gon.hcl"
8+
9+
cat <<-EOF > "$config"
10+
source = ["$binary"]
11+
bundle_id = "com.bendrucker.terraform-credentials-keychain"
12+
13+
apple_id {
14+
username = "bvdrucker@gmail.com"
15+
}
16+
17+
sign {
18+
application_identity = "Developer ID Application: Benjamin V Drucker"
19+
}
20+
21+
zip {
22+
output_path = "$zip"
23+
}
24+
EOF
25+
26+
gon "$config"

keychain.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ var _ credentialhelper.Helper = (*KeychainHelper)(nil)
1515

1616
// Open opens a keyring for Terraform
1717
func (h *KeychainHelper) Open() (keyring.Keyring, error) {
18-
return keyring.Open(keyring.Config{ServiceName: "terraform"})
18+
return keyring.Open(keyring.Config{
19+
ServiceName: "terraform",
20+
})
1921
}
2022

2123
// Get gets the stored credentials from the keyring

0 commit comments

Comments
 (0)