Skip to content

Commit b04cb45

Browse files
author
adjabaev
authored
Curl & revert apple certificates
1 parent ef8d8d0 commit b04cb45

7 files changed

+124
-11
lines changed

.github/workflows/build-all.yml

+62-5
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,43 @@ jobs:
207207
with:
208208
java-version: '8'
209209
distribution: 'adopt'
210+
- name: Install Apple certificate
211+
env:
212+
BUILD_CERTIFICATE_BASE64: ${{ secrets.APPLE_BUILD_CERTIFICATE_BASE64 }}
213+
P12_PASSWORD: ${{ secrets.APPLE_P12_PASSWORD }}
214+
KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
215+
APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
216+
APPLE_API_KEY_NAME: ${{ secrets.APPLE_API_KEY_NAME }}
217+
run: |
218+
# create variables
219+
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
220+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
221+
222+
# import certificate from secrets
223+
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
224+
225+
# create temporary keychain
226+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
227+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
228+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
229+
230+
# import certificate to keychain
231+
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH -T /usr/bin/codesign
232+
security list-keychain -d user -s $KEYCHAIN_PATH
233+
234+
# import api key from secrets
235+
mkdir "${HOME}/private_keys"
236+
echo -n "$APPLE_API_KEY_BASE64" | base64 --decode --output "${HOME}/private_keys/AuthKey_$APPLE_API_KEY_NAME.p8"
210237
-
211238
name: Build
212239
run: |
213240
chmod +x compile_macosx.sh
214-
./compile_macosx.sh amd64 Release ${{ github.event.inputs.repo }} ${{ github.event.inputs.ref }}
241+
./compile_macosx.sh amd64 Release ${{ github.event.inputs.repo }} ${{ github.event.inputs.ref }} "${{ secrets.APPLE_BUILD_CERTIFICATE_NAME }}" ${{ secrets.APPLE_TEAM_NAME }} ${{ secrets.APPLE_API_KEY_ID }} "${HOME}/private_keys/AuthKey_${{ secrets.APPLE_API_KEY_NAME }}.p8" ${{ secrets.APPLE_API_KEY_ISSUER }}
242+
- name: Clean up keychain
243+
if: ${{ always() }}
244+
run: |
245+
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
246+
rm -rf "${HOME}/private_keys"
215247
- name: Export distribution
216248
run: |
217249
mv out/binary_distrib.tar.gz out/macosx-amd64.tar.gz
@@ -242,11 +274,38 @@ jobs:
242274
with:
243275
java-version: '8'
244276
distribution: 'adopt'
277+
- name: Install Apple certificate
278+
env:
279+
BUILD_CERTIFICATE_BASE64: ${{ secrets.APPLE_BUILD_CERTIFICATE_BASE64 }}
280+
P12_PASSWORD: ${{ secrets.APPLE_P12_PASSWORD }}
281+
KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
282+
APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
283+
APPLE_API_KEY_NAME: ${{ secrets.APPLE_API_KEY_NAME }}
284+
run: |
285+
# create variables
286+
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
287+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
288+
289+
# import certificate from secrets
290+
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
291+
292+
# create temporary keychain
293+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
294+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
295+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
296+
297+
# import certificate to keychain
298+
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH -T /usr/bin/codesign
299+
security list-keychain -d user -s $KEYCHAIN_PATH
300+
301+
# import api key from secrets
302+
mkdir "${HOME}/private_keys"
303+
echo -n "$APPLE_API_KEY_BASE64" | base64 --decode --output "${HOME}/private_keys/AuthKey_$APPLE_API_KEY_NAME.p8"
245304
-
246305
name: Build
247306
run: |
248307
chmod +x compile_macosx.sh
249-
./compile_macosx.sh arm64 Release ${{ github.event.inputs.repo }} ${{ github.event.inputs.ref }}
308+
./compile_macosx.sh arm64 Release ${{ github.event.inputs.repo }} ${{ github.event.inputs.ref }} "${{ secrets.APPLE_BUILD_CERTIFICATE_NAME }}" ${{ secrets.APPLE_TEAM_NAME }} ${{ secrets.APPLE_API_KEY_ID }} "${HOME}/private_keys/AuthKey_${{ secrets.APPLE_API_KEY_NAME }}.p8" ${{ secrets.APPLE_API_KEY_ISSUER }}
250309
- name: Clean up keychain
251310
if: ${{ always() }}
252311
run: |
@@ -257,6 +316,4 @@ jobs:
257316
mv out/binary_distrib.tar.gz out/macosx-arm64.tar.gz
258317
gh release upload ${{needs.create-release.outputs.release_tag_name}} out/macosx-arm64.tar.gz
259318
env:
260-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
261-
262-
319+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build-macosx-amd64.yml

+29-3
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,38 @@ jobs:
2727
with:
2828
java-version: '8'
2929
distribution: 'adopt'
30+
- name: Install Apple certificate
31+
env:
32+
BUILD_CERTIFICATE_BASE64: ${{ secrets.APPLE_BUILD_CERTIFICATE_BASE64 }}
33+
P12_PASSWORD: ${{ secrets.APPLE_P12_PASSWORD }}
34+
KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
35+
APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
36+
APPLE_API_KEY_NAME: ${{ secrets.APPLE_API_KEY_NAME }}
37+
run: |
38+
# create variables
39+
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
40+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
41+
42+
# import certificate from secrets
43+
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
44+
45+
# create temporary keychain
46+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
47+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
48+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
49+
50+
# import certificate to keychain
51+
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH -T /usr/bin/codesign
52+
security list-keychain -d user -s $KEYCHAIN_PATH
53+
54+
# import api key from secrets
55+
mkdir "${HOME}/private_keys"
56+
echo -n "$APPLE_API_KEY_BASE64" | base64 --decode --output "${HOME}/private_keys/AuthKey_$APPLE_API_KEY_NAME.p8"
3057
-
3158
name: Build
3259
run: |
3360
chmod +x compile_macosx.sh
34-
./compile_macosx.sh amd64 Release ${{ github.event.inputs.repo }} ${{ github.event.inputs.ref }}
61+
./compile_macosx.sh amd64 Release ${{ github.event.inputs.repo }} ${{ github.event.inputs.ref }} "${{ secrets.APPLE_BUILD_CERTIFICATE_NAME }}" ${{ secrets.APPLE_TEAM_NAME }} ${{ secrets.APPLE_API_KEY_ID }} "${HOME}/private_keys/AuthKey_${{ secrets.APPLE_API_KEY_NAME }}.p8" ${{ secrets.APPLE_API_KEY_ISSUER }}
3562
- name: Clean up keychain
3663
if: ${{ always() }}
3764
run: |
@@ -42,5 +69,4 @@ jobs:
4269
uses: actions/upload-artifact@v3
4370
with:
4471
name: macosx-amd64.tar.gz
45-
path: out/binary_distrib.tar.gz
46-
72+
path: out/binary_distrib.tar.gz

.github/workflows/build-macosx-arm64.yml

+29-3
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,38 @@ jobs:
2727
with:
2828
java-version: '8'
2929
distribution: 'adopt'
30+
- name: Install Apple certificate
31+
env:
32+
BUILD_CERTIFICATE_BASE64: ${{ secrets.APPLE_BUILD_CERTIFICATE_BASE64 }}
33+
P12_PASSWORD: ${{ secrets.APPLE_P12_PASSWORD }}
34+
KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
35+
APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
36+
APPLE_API_KEY_NAME: ${{ secrets.APPLE_API_KEY_NAME }}
37+
run: |
38+
# create variables
39+
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
40+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
41+
42+
# import certificate from secrets
43+
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
44+
45+
# create temporary keychain
46+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
47+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
48+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
49+
50+
# import certificate to keychain
51+
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH -T /usr/bin/codesign
52+
security list-keychain -d user -s $KEYCHAIN_PATH
53+
54+
# import api key from secrets
55+
mkdir "${HOME}/private_keys"
56+
echo -n "$APPLE_API_KEY_BASE64" | base64 --decode --output "${HOME}/private_keys/AuthKey_$APPLE_API_KEY_NAME.p8"
3057
-
3158
name: Build
3259
run: |
3360
chmod +x compile_macosx.sh
34-
./compile_macosx.sh arm64 Release ${{ github.event.inputs.repo }} ${{ github.event.inputs.ref }}
61+
./compile_macosx.sh arm64 Release ${{ github.event.inputs.repo }} ${{ github.event.inputs.ref }} "${{ secrets.APPLE_BUILD_CERTIFICATE_NAME }}" ${{ secrets.APPLE_TEAM_NAME }} ${{ secrets.APPLE_API_KEY_ID }} "${HOME}/private_keys/AuthKey_${{ secrets.APPLE_API_KEY_NAME }}.p8" ${{ secrets.APPLE_API_KEY_ISSUER }}
3562
- name: Clean up keychain
3663
if: ${{ always() }}
3764
run: |
@@ -42,5 +69,4 @@ jobs:
4269
uses: actions/upload-artifact@v3
4370
with:
4471
name: macosx-arm64.tar.gz
45-
path: out/binary_distrib.tar.gz
46-
72+
path: out/binary_distrib.tar.gz

compile_macosx.sh

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ if [ ! -f "jcef/README.md" ]; then
3939
git clone ${REPO} jcef
4040
cd jcef
4141
git checkout ${REF}
42+
curl -o a7.patch https://raw.githubusercontent.com/adjabaev/jcefbuild/master/a7.patch
4243
git apply a7.patch
4344
#No CMakeLists patching required on macos, as we do not add any new platforms
4445
else

scripts/run_linux.sh

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ if [ ! -f "/jcef/README.md" ]; then
2323
git clone ${REPO} /jcef
2424
cd /jcef
2525
git checkout ${REF}
26+
curl -o a7.patch https://raw.githubusercontent.com/adjabaev/jcefbuild/master/a7.patch
2627
git apply a7.patch
2728
else
2829
echo "Found existing files to build"

scripts/run_linux_prebuild.sh

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if [ ! -f "/jcef/README.md" ]; then
2020
git clone ${REPO} /jcef
2121
cd /jcef
2222
git checkout ${REF}
23+
curl -o a7.patch https://raw.githubusercontent.com/adjabaev/jcefbuild/master/a7.patch
2324
git apply a7.patch
2425
else
2526
echo "Found existing files to build"

scripts/run_windows.bat

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ if exist jcef rmdir /S /Q jcef
5858
git clone %REPO% jcef
5959
cd jcef
6060
git checkout %REF%
61+
curl -o a7.patch https://raw.githubusercontent.com/adjabaev/jcefbuild/master/a7.patch
6162
git apply a7.patch
6263
GOTO :BUILD
6364

0 commit comments

Comments
 (0)