Skip to content

Commit 03cda0d

Browse files
committed
fix(ci): embed asc api key content
1 parent 03fc9ca commit 03cda0d

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

.github/workflows/build.yaml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -322,16 +322,30 @@ jobs:
322322

323323
- name: Prepare App Store Connect API Key
324324
if: ${{ env.testflight_ready == 'true' }}
325+
env:
326+
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
327+
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
325328
run: |
326329
mkdir -p ${{ runner.temp }}/asc_key
327330
echo "${{ secrets.APP_STORE_CONNECT_KEY_P8 }}" | base64 --decode > ${{ runner.temp }}/asc_key/AuthKey.p8
328-
cat > ${{ runner.temp }}/asc_key/api_key.json <<EOF
329-
{
330-
"key_id": "${{ secrets.APP_STORE_CONNECT_KEY_ID }}",
331-
"issuer_id": "${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}",
332-
"key_filepath": "${{ runner.temp }}/asc_key/AuthKey.p8"
331+
python3 - <<'PY'
332+
import json
333+
import os
334+
335+
key_path = os.path.join(os.environ['RUNNER_TEMP'], 'asc_key', 'AuthKey.p8')
336+
with open(key_path, 'r', encoding='utf-8') as f:
337+
key_content = f.read().strip()
338+
339+
data = {
340+
'key_id': os.environ.get('APP_STORE_CONNECT_KEY_ID', ''),
341+
'issuer_id': os.environ.get('APP_STORE_CONNECT_ISSUER_ID', ''),
342+
'key': key_content,
333343
}
334-
EOF
344+
345+
out_path = os.path.join(os.environ['RUNNER_TEMP'], 'asc_key', 'api_key.json')
346+
with open(out_path, 'w', encoding='utf-8') as f:
347+
json.dump(data, f)
348+
PY
335349
336350
- name: Upload to TestFlight
337351
if: ${{ env.testflight_ready == 'true' }}

0 commit comments

Comments
 (0)