Skip to content

Commit

Permalink
Provide a way to decode an encoded Apple certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
waliid committed Nov 21, 2024
1 parent be2c12a commit c83956e
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 37 deletions.
79 changes: 42 additions & 37 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,42 @@ name: Pull Request
on: [push]

jobs:
check-quality:
name: "🔎 Check quality"
runs-on: tart
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run the quality check
run: make check-quality

build-documentation:
name: "📚 Build documentation"
runs-on: tart
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build the documentation
run: make doc

tests:
name: "🧪 Tests"
runs-on: tart
strategy:
matrix:
platform: [ios, tvos]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Authorize microphone access for simulator
run: Scripts/bypass-simulator-trampoline.sh

- name: Run tests
run: make test-${{ matrix.platform }}

# check-quality:
# name: "🔎 Check quality"
# runs-on: tart
# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Run the quality check
# run: make check-quality

# build-documentation:
# name: "📚 Build documentation"
# runs-on: tart
# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Build the documentation
# run: make doc

# tests:
# name: "🧪 Tests"
# runs-on: tart
# strategy:
# matrix:
# platform: [ios, tvos]
# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Authorize microphone access for simulator
# run: Scripts/bypass-simulator-trampoline.sh

# - name: Run tests
# run: make test-${{ matrix.platform }}
#
archive-demos:
name: "📦 Archives"
runs-on: tart
Expand All @@ -50,5 +50,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Add Apple certificate
run: |
Scripts/add-apple-certificate.sh \
${{ secrets.SRGSSR_APPLE_DEV_CERTIFICATE_B64 }}
- name: Archive the demo
run: make archive-demo-${{ matrix.platform }}
run: sleep 60 #make archive-demo-${{ matrix.platform }}
22 changes: 22 additions & 0 deletions Scripts/add-apple-certificate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

apple_certificate="$1"

if [[ -z $apple_certificate ]]
then
echo "[!] Usage: $0 <apple_certificate_encoded (base64)>"
exit 1
fi

apple_certificate_password=""
apple_certificate_decoded_path="/tmp/apple_certificate_decoded.p12"

keychain_password="admin"
keychain_path="$HOME/Library/Keychains/login.keychain-db"

base64 --decode --input "$apple_certificate" > $apple_certificate_decoded_path

# Import certificate
security import "$apple_certificate_decoded_path" -k "$keychain_path" -P "$apple_certificate_password" -T /usr/bin/security -T /usr/bin/codesign
# Authorize access to certificate private key
security set-key-partition-list -S apple-tool:,apple: -s -k "$keychain_password" "$keychain_path"

0 comments on commit c83956e

Please sign in to comment.