2022-04-25 05:39:40 +02:00
|
|
|
name: Sign macOS binaries
|
2022-04-24 18:40:28 +02:00
|
|
|
on:
|
|
|
|
workflow_run:
|
|
|
|
workflows: ["SLSA go releaser"]
|
|
|
|
types:
|
|
|
|
- completed
|
2022-04-24 18:42:12 +02:00
|
|
|
workflow_dispatch:
|
2022-04-24 18:40:28 +02:00
|
|
|
jobs:
|
|
|
|
macos:
|
|
|
|
runs-on: macos-11.0
|
|
|
|
steps:
|
2022-04-25 07:05:18 +02:00
|
|
|
- uses: actions/checkout@v2
|
2022-04-24 19:06:06 +02:00
|
|
|
- name: Download and sign the latest executables
|
|
|
|
env:
|
|
|
|
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
|
2022-04-25 05:34:44 +02:00
|
|
|
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
|
2022-04-24 18:40:28 +02:00
|
|
|
run: |
|
2022-04-25 06:50:03 +02:00
|
|
|
brew install md5sha1sum
|
2022-04-24 18:40:28 +02:00
|
|
|
export TAG_NAME=`curl https://api.github.com/repos/ddworken/hishtory/releases/latest | jq -r .tag_name`
|
|
|
|
curl -o hishtory-darwin-arm64 https://github.com/ddworken/hishtory/releases/download/$TAG_NAME-darwin-arm64/hishtory-darwin-arm64
|
|
|
|
curl -o hishtory-darwin-amd64 https://github.com/ddworken/hishtory/releases/download/$TAG_NAME-darwin-arm64/hishtory-darwin-amd64
|
2022-04-25 06:48:06 +02:00
|
|
|
echo "Signing the binaries:"
|
|
|
|
sha1sum hishtory-*
|
|
|
|
echo "xattr:"
|
|
|
|
xattr hishtory-darwin-arm64
|
2022-04-25 05:36:46 +02:00
|
|
|
echo $MACOS_CERTIFICATE | base64 -d > certificate.p12
|
2022-04-25 05:34:44 +02:00
|
|
|
security create-keychain -p $MACOS_CERTIFICATE_PWD build.keychain
|
2022-04-24 18:40:28 +02:00
|
|
|
security default-keychain -s build.keychain
|
2022-04-25 05:34:44 +02:00
|
|
|
security unlock-keychain -p $MACOS_CERTIFICATE_PWD build.keychain
|
|
|
|
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
|
|
|
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_CERTIFICATE_PWD build.keychain
|
2022-04-24 18:40:28 +02:00
|
|
|
/usr/bin/codesign --force -s 6D4E1575A0D40C370E294916A8390797106C8A6E hishtory-darwin-arm64 -v
|
2022-04-25 05:34:44 +02:00
|
|
|
/usr/bin/codesign --force -s 6D4E1575A0D40C370E294916A8390797106C8A6E hishtory-darwin-amd64 -v
|
2022-04-25 06:48:06 +02:00
|
|
|
echo "Signed the binaries:"
|
|
|
|
sha1sum hishtory-*
|
|
|
|
echo "xattr:"
|
|
|
|
xattr hishtory-darwin-arm64
|
2022-04-25 07:04:16 +02:00
|
|
|
echo "Exporting xattr"
|
|
|
|
xattr -p com.apple.cs.CodeDirectory hishtory-darwin-arm64 >> hishtory-darwin-arm64.xattr
|
|
|
|
xattr -p com.apple.cs.CodeRequirements hishtory-darwin-arm64 >> hishtory-darwin-arm64.xattr
|
|
|
|
xattr -p com.apple.cs.CodeRequirements-1 hishtory-darwin-arm64 >> hishtory-darwin-arm64.xattr
|
|
|
|
xattr -p com.apple.cs.CodeSignature hishtory-darwin-arm64 >> hishtory-darwin-arm64.xattr
|
|
|
|
xattr -p com.apple.cs.CodeDirectory hishtory-darwin-amd64 >> hishtory-darwin-amd64.xattr
|
|
|
|
xattr -p com.apple.cs.CodeRequirements hishtory-darwin-amd64 >> hishtory-darwin-amd64.xattr
|
|
|
|
xattr -p com.apple.cs.CodeRequirements-1 hishtory-darwin-amd64 >> hishtory-darwin-amd64.xattr
|
|
|
|
xattr -p com.apple.cs.CodeSignature hishtory-darwin-amd64 >> hishtory-darwin-amd64.xattr
|
|
|
|
- name: Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
with:
|
|
|
|
files:
|
|
|
|
- hishtory-darwin-arm64.xattr
|
|
|
|
- hishtory-darwin-amd64.xattr
|