-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added code to build, sign and notarize via github action
- Loading branch information
1 parent
a22067e
commit 93f8835
Showing
10 changed files
with
134 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: kencochrane |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: build and sign binaries | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
name: Build the binaries | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Build | ||
run: | | ||
./build.sh | ||
- name: upload binary artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: binaries | ||
path: release/ | ||
release: | ||
needs: build | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Download-Binaries | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: binaries | ||
path: release/ | ||
|
||
- name: Display structure of downloaded files | ||
run: ls -R | ||
|
||
- name: Import Code-Signing Certificates | ||
uses: Apple-Actions/import-codesign-certs@v1 | ||
with: | ||
# The certificates in a PKCS12 file encoded as a base64 string | ||
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} | ||
# The password used to import the PKCS12 file. | ||
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} | ||
|
||
- name: Install gon via HomeBrew for code signing and app notarization | ||
run: | | ||
brew tap mitchellh/gon | ||
brew install mitchellh/gon/gon | ||
- name: Sign the mac binaries with Gon | ||
env: | ||
AC_USERNAME: ${{ secrets.AC_USERNAME }} | ||
AC_PASSWORD: ${{ secrets.AC_PASSWORD }} | ||
run: | | ||
./sign.sh | ||
- name: Archive Mac DiskImage distributable | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Released-Mac-DiskImage | ||
path: release/darwin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
BINARY := hello-github | ||
|
||
.PHONY: windows | ||
windows: | ||
mkdir -p release/windows/ | ||
GOOS=windows GOARCH=amd64 go build -o release/windows/$(BINARY).exe | ||
|
||
.PHONY: linux | ||
linux: | ||
mkdir -p release/linux/ | ||
GOOS=linux GOARCH=amd64 go build -o release/linux/$(BINARY) | ||
|
||
.PHONY: darwin | ||
darwin: | ||
mkdir -p release/darwin/ | ||
GOOS=darwin GOARCH=amd64 go build -o release/darwin/$(BINARY) | ||
|
||
.PHONY: build | ||
build: windows linux darwin | ||
|
||
.PHONY: sign | ||
sign: | ||
# sign | ||
gon -log-level=debug -log-json ./gon.json | ||
|
||
.PHONY: release | ||
release: sign |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
# golang-github-action-sign-macos | ||
Example repo showing how to use Github Actions to sign a golang binary for macos | ||
Example repo showing how to use Github Actions to sign and notarize a Golang binary for MacOS. | ||
|
||
|
||
See blog post for more information. | ||
- Add link to https://www.kencochrane.com once published |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
docker run --rm -v `pwd`:/usr/src/myapp -v `pwd`/vendor:/go/src -w /usr/src/myapp golang:1.14 /usr/src/myapp/build_app.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
# build all three versions windows, linux, mac, in parallel | ||
make build -j3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"source" : ["./release/darwin/hello-github"], | ||
"bundle_id" : "com.kencochrane.hello-github", | ||
"apple_id": { | ||
"password": "@env:AC_PASSWORD" | ||
}, | ||
"sign" :{ | ||
"application_identity" : "4194587FE60D93D416CF3F4669FF913C7BBA4271" | ||
}, | ||
"dmg" :{ | ||
"output_path": "./release/darwin/hello-github.dmg", | ||
"volume_name": "hello-github" | ||
}, | ||
"zip" :{ | ||
"output_path" : "./release/darwin/hello-github.zip" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
fmt.Println("Hello GitHub!") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
# sign the mac version | ||
make sign |