Skip to content

Commit

Permalink
New release mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
iann0036 committed Mar 19, 2021
1 parent 908cd98 commit 04f2e41
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 25 deletions.
57 changes: 32 additions & 25 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
on:
release:
types: [created]
name: Release

on:
push:
tags:
- '*'

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
goos: [linux, windows, darwin]
goarch: ["386", amd64, arm64]
exclude:
- goos: darwin
goarch: "386"
- goos: windows
goarch: arm64
goreleaser:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: iann0036/go-release-action@v1.14
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "https://golang.org/dl/go1.16.linux-amd64.tar.gz"
binary_name: "iamlive"
pre_command: export CGO_ENABLED=0
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Set up Gon
run: brew tap mitchellh/gon && brew install mitchellh/gon/gon
- name: Import Keychain Certs
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
18 changes: 18 additions & 0 deletions .gon-amd64.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"source": ["./dist/macos-amd64_darwin_amd64/iamlive"],
"bundle_id": "com.iann0036.iamlive",
"apple_id": {
"username" : "apple@ian.mn",
"password": "@env:AC_PASSWORD"
},
"sign": {
"application_identity" : "Developer ID Application: Ian McKay (R7ZQG222E8)"
},
"dmg" :{
"output_path": "./dist/iamlive-darwin-amd64.dmg",
"volume_name": "iamlive"
},
"zip" :{
"output_path": "./dist/iamlive-darwin-amd64.zip"
}
}
18 changes: 18 additions & 0 deletions .gon-arm64.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"source": ["./dist/macos-arm64_darwin_arm64/iamlive"],
"bundle_id": "com.iann0036.iamlive",
"apple_id": {
"username" : "apple@ian.mn",
"password": "@env:AC_PASSWORD"
},
"sign": {
"application_identity" : "Developer ID Application: Ian McKay (R7ZQG222E8)"
},
"dmg" :{
"output_path": "./dist/iamlive-darwin-arm64.dmg",
"volume_name": "iamlive"
},
"zip" :{
"output_path": "./dist/iamlive-darwin-arm64.zip"
}
}
94 changes: 94 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
builds:
- binary: iamlive
env:
- CGO_ENABLED=0
id: windows
goos:
- windows
goarch:
- "386"
- amd64
- binary: iamlive
env:
- CGO_ENABLED=0
id: linux
goos:
- linux
goarch:
- "386"
- amd64
- arm64
- binary: iamlive
env:
- CGO_ENABLED=0
id: macos-amd64
goos:
- darwin
goarch:
- amd64
hooks:
post:
- gon .gon-amd64.json
- mv dist/iamlive-darwin-amd64.dmg dist/iamlive-v{{ .Version }}-darwin-amd64.dmg
- mv dist/iamlive-darwin-amd64.zip dist/iamlive-v{{ .Version }}-darwin-amd64.zip
- ls dist/
- binary: iamlive
env:
- CGO_ENABLED=0
id: macos-arm64
goos:
- darwin
goarch:
- arm64
hooks:
post:
- gon .gon-arm64.json
- mv dist/iamlive-darwin-arm64.dmg dist/iamlive-v{{ .Version }}-darwin-arm64.dmg
- mv dist/iamlive-darwin-arm64.zip dist/iamlive-v{{ .Version }}-darwin-arm64.zip
- ls dist/
archives:
- id: linux-archive
builds:
- linux
format: tar.gz
name_template: "{{ .ProjectName }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}"
files:
- none*
- id: windows-archive
builds:
- windows
format: zip
name_template: "{{ .ProjectName }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}"
files:
- none*
- id: darwin-archive
builds:
- macos-amd64
- macos-arm64
format: tar.gz
name_template: "{{ .ProjectName }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}"
files:
- none*
release:
ids:
- linux-archive
- windows-archive
extra_files:
- glob: ./dist/*.dmg
- glob: ./dist/*-darwin-amd64.zip
- glob: ./dist/*-darwin-arm64.zip
brews:
- name: iamlive
ids:
- darwin-archive
tap:
owner: iann0036
name: homebrew-iamlive
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
url_template: "https://github.com/iann0036/iamlive/releases/download/{{ .Tag }}/iamlive-v{{ .Version }}-{{ .Os }}-{{ .Arch }}.zip"
commit_author:
name: Ian Mckay (BOT)
email: github-bot@ian.mn
homepage: "https://github.com/iann0036/iamlive"
description: "Generate an IAM policy from AWS calls using client-side monitoring (CSM) or embedded proxy."
license: "MIT"

0 comments on commit 04f2e41

Please sign in to comment.