Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: C/C++ CI

on: [push]

jobs:
build:

runs-on: macOS-latest

steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: install certificates
run: |
install/mac_install_certificate "${{ secrets.APPLICATION_CERT }}" "${{ secrets.APPLICATION_CERT_NAME }}"
install/mac_install_certificate "${{ secrets.INSTALLER_CERT }}" "${{ secrets.INSTALLER_CERT_NAME }}"
# - name: build
# run: install/mac_build
# - name: test
# run: tests/mac_tests

38 changes: 38 additions & 0 deletions install/mac_install_certificate
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash -e

CERT_BASE64_STRING=$1
CERT_FILE_NAME=$2

if [ -z "$CERT_BASE64_STRING" ]; then
echo "CERT_BASE64_STRING needed as first arg!"
exit 1
fi

if [ -z "$CERT_FILE_NAME" ]; then
echo "CERT_FILE_NAME needed as second arg!"
exit 1
fi

#========================================================================
# Create the cert file from the base 64 string arg
CERT_BASE64_FILE="/tmp/$CERT_FILE_NAME"
rm "$CERT_BASE64_FILE"
touch "$CERT_BASE64_FILE"
echo "$CERT_BASE64_STRING" > "$CERT_BASE64_FILE"

#========================================================================
# Make sure the cert file is cleaned up on exit
function cleanup
{
echo "Removing CERT_BASE64_FILE: $CERT_BASE64_FILE"
rm "$CERT_BASE64_FILE"
}

trap cleanup EXIT

#========================================================================
# Create a file from the base 64 file
openssl base64 -d -in "$CERT_BASE64_FILE" -out "$CERT_FILE_PATH"

# Then import it in to the login keychain
security import "$CERT_FILE_PATH" -k ~/Library/Keychains/login.keychain