Revive MacOS signing #10
Workflow file for this run
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
name: release | |
on: | |
push: | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
jobs: | |
pre_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
release: | |
needs: pre_release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.20.2 | |
- name: git cleanup | |
run: git clean -f | |
- name: Run GoReleaser | |
uses: goreleaser/[email protected] | |
with: | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build_with_signing: | |
runs-on: macos-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.2 | |
- name: Prepare keys | |
env: | |
CERT: certificate.p12 | |
CERT_PASSWORD: "" | |
MY_KEYCHAIN: build.keychain | |
MY_KEYCHAIN_PASSWORD: ${{ secrets.CERTIFICATE_ID }} | |
IDENTITY_CERTIFICATE: "Developer ID Application: Komodor Automation LTD (F584U99DLC)" | |
run: | | |
echo Decode the certificate | |
echo ${{ secrets.CERTIFICATE_BASE64 }} | base64 --decode > $CERT | |
# default again user login keychain | |
security list-keychains -d user -s login.keychain | |
# Create temp keychain | |
security create-keychain -p "$MY_KEYCHAIN_PASSWORD" "$MY_KEYCHAIN" | |
# Append temp keychain to the user domain | |
security list-keychains -d user -s "$MY_KEYCHAIN" $(security list-keychains -d user | sed s/\"//g) | |
# Remove relock timeout | |
security set-keychain-settings "$MY_KEYCHAIN" | |
# Unlock keychain | |
security unlock-keychain -p "$MY_KEYCHAIN_PASSWORD" "$MY_KEYCHAIN" | |
# Add certificate to keychain | |
security import $CERT -k "$MY_KEYCHAIN" -P "$CERT_PASSWORD" -A -T "/usr/bin/codesign" | |
# Enable codesigning from a non user interactive shell | |
security set-key-partition-list -S apple-tool:,apple:, -t private -s -k "$MY_KEYCHAIN_PASSWORD" -D "${IDENTITY_CERTIFICATE}" "$MY_KEYCHAIN" | |
- name: Dry Run GoReleaser | |
uses: goreleaser/goreleaser-action@v2 | |
with: | |
version: latest | |
args: release --config .goreleaser-mac.yml --parallelism 1 --snapshot --clean | |
env: | |
CERTIFICATE_ID: ${{ secrets.CERTIFICATE_ID }} | |
- name: Test Binary is Signed | |
run: | | |
codesign -dv dist/build_macos_darwin_amd64_v1/komocli | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: binaries-mac | |
path: dist/ | |
retention-days: 1 |