Skip to content

Commit 04f2e41

Browse files
committed
New release mechanism
1 parent 908cd98 commit 04f2e41

4 files changed

Lines changed: 162 additions & 25 deletions

File tree

.github/workflows/release.yaml

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
1-
on:
2-
release:
3-
types: [created]
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
47

58
jobs:
6-
releases-matrix:
7-
name: Release Go Binary
8-
runs-on: ubuntu-latest
9-
strategy:
10-
matrix:
11-
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
12-
goos: [linux, windows, darwin]
13-
goarch: ["386", amd64, arm64]
14-
exclude:
15-
- goos: darwin
16-
goarch: "386"
17-
- goos: windows
18-
goarch: arm64
9+
goreleaser:
10+
runs-on: macos-latest
1911
steps:
20-
- uses: actions/checkout@v2
21-
- uses: iann0036/go-release-action@v1.14
22-
with:
23-
github_token: ${{ secrets.GITHUB_TOKEN }}
24-
goos: ${{ matrix.goos }}
25-
goarch: ${{ matrix.goarch }}
26-
goversion: "https://golang.org/dl/go1.16.linux-amd64.tar.gz"
27-
binary_name: "iamlive"
28-
pre_command: export CGO_ENABLED=0
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
- name: Set up Go
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: 1.16
20+
- name: Set up Gon
21+
run: brew tap mitchellh/gon && brew install mitchellh/gon/gon
22+
- name: Import Keychain Certs
23+
uses: apple-actions/import-codesign-certs@v1
24+
with:
25+
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
26+
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
27+
- name: Run GoReleaser
28+
uses: goreleaser/goreleaser-action@v2
29+
with:
30+
version: latest
31+
args: release --rm-dist
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
35+
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}

.gon-amd64.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"source": ["./dist/macos-amd64_darwin_amd64/iamlive"],
3+
"bundle_id": "com.iann0036.iamlive",
4+
"apple_id": {
5+
"username" : "apple@ian.mn",
6+
"password": "@env:AC_PASSWORD"
7+
},
8+
"sign": {
9+
"application_identity" : "Developer ID Application: Ian McKay (R7ZQG222E8)"
10+
},
11+
"dmg" :{
12+
"output_path": "./dist/iamlive-darwin-amd64.dmg",
13+
"volume_name": "iamlive"
14+
},
15+
"zip" :{
16+
"output_path": "./dist/iamlive-darwin-amd64.zip"
17+
}
18+
}

.gon-arm64.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"source": ["./dist/macos-arm64_darwin_arm64/iamlive"],
3+
"bundle_id": "com.iann0036.iamlive",
4+
"apple_id": {
5+
"username" : "apple@ian.mn",
6+
"password": "@env:AC_PASSWORD"
7+
},
8+
"sign": {
9+
"application_identity" : "Developer ID Application: Ian McKay (R7ZQG222E8)"
10+
},
11+
"dmg" :{
12+
"output_path": "./dist/iamlive-darwin-arm64.dmg",
13+
"volume_name": "iamlive"
14+
},
15+
"zip" :{
16+
"output_path": "./dist/iamlive-darwin-arm64.zip"
17+
}
18+
}

.goreleaser.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
builds:
2+
- binary: iamlive
3+
env:
4+
- CGO_ENABLED=0
5+
id: windows
6+
goos:
7+
- windows
8+
goarch:
9+
- "386"
10+
- amd64
11+
- binary: iamlive
12+
env:
13+
- CGO_ENABLED=0
14+
id: linux
15+
goos:
16+
- linux
17+
goarch:
18+
- "386"
19+
- amd64
20+
- arm64
21+
- binary: iamlive
22+
env:
23+
- CGO_ENABLED=0
24+
id: macos-amd64
25+
goos:
26+
- darwin
27+
goarch:
28+
- amd64
29+
hooks:
30+
post:
31+
- gon .gon-amd64.json
32+
- mv dist/iamlive-darwin-amd64.dmg dist/iamlive-v{{ .Version }}-darwin-amd64.dmg
33+
- mv dist/iamlive-darwin-amd64.zip dist/iamlive-v{{ .Version }}-darwin-amd64.zip
34+
- ls dist/
35+
- binary: iamlive
36+
env:
37+
- CGO_ENABLED=0
38+
id: macos-arm64
39+
goos:
40+
- darwin
41+
goarch:
42+
- arm64
43+
hooks:
44+
post:
45+
- gon .gon-arm64.json
46+
- mv dist/iamlive-darwin-arm64.dmg dist/iamlive-v{{ .Version }}-darwin-arm64.dmg
47+
- mv dist/iamlive-darwin-arm64.zip dist/iamlive-v{{ .Version }}-darwin-arm64.zip
48+
- ls dist/
49+
archives:
50+
- id: linux-archive
51+
builds:
52+
- linux
53+
format: tar.gz
54+
name_template: "{{ .ProjectName }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}"
55+
files:
56+
- none*
57+
- id: windows-archive
58+
builds:
59+
- windows
60+
format: zip
61+
name_template: "{{ .ProjectName }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}"
62+
files:
63+
- none*
64+
- id: darwin-archive
65+
builds:
66+
- macos-amd64
67+
- macos-arm64
68+
format: tar.gz
69+
name_template: "{{ .ProjectName }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}"
70+
files:
71+
- none*
72+
release:
73+
ids:
74+
- linux-archive
75+
- windows-archive
76+
extra_files:
77+
- glob: ./dist/*.dmg
78+
- glob: ./dist/*-darwin-amd64.zip
79+
- glob: ./dist/*-darwin-arm64.zip
80+
brews:
81+
- name: iamlive
82+
ids:
83+
- darwin-archive
84+
tap:
85+
owner: iann0036
86+
name: homebrew-iamlive
87+
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
88+
url_template: "https://github.com/iann0036/iamlive/releases/download/{{ .Tag }}/iamlive-v{{ .Version }}-{{ .Os }}-{{ .Arch }}.zip"
89+
commit_author:
90+
name: Ian Mckay (BOT)
91+
email: github-bot@ian.mn
92+
homepage: "https://github.com/iann0036/iamlive"
93+
description: "Generate an IAM policy from AWS calls using client-side monitoring (CSM) or embedded proxy."
94+
license: "MIT"

0 commit comments

Comments
 (0)