@@ -20,25 +20,25 @@ jobs:
2020 java-version : ' 17'
2121 distribution : ' temurin'
2222
23+ # Step 1: Sign JARs and set SIGNED_JARS_DIR as output
2324 - name : Codesign JARs and Internal Native Libraries
25+ id : sign_jars # Assign an id to reference outputs
2426 env :
2527 MACOS_CERTIFICATE : ${{ secrets.MACOS_CERTIFICATE }}
2628 MACOS_CERTIFICATE_PWD : ${{ secrets.MACOS_CERTIFICATE_PWD }}
2729 run : |
28- # Step 1: Decode and import the certificate into a keychain
29- echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
30- /usr/bin/security create-keychain -p espressif build.keychain
31- /usr/bin/security default-keychain -s build.keychain
32- /usr/bin/security unlock-keychain -p espressif build.keychain
33- /usr/bin/security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
34- /usr/bin/security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k espressif build.keychain
35-
36- # Step 2: Define the directory containing the JARs and native libraries and the temp directory for signed JARs
37- LIB_DIR="${PWD}/BUNDLES/com.espressif.idf.serial.monitor/lib"
38- SIGNED_JARS_DIR="${RUNNER_TEMP}/signed-jars" # Use GitHub's RUNNER_TEMP for storing signed JARs
30+ # Create the directory for signed JARs
31+ SIGNED_JARS_DIR="${RUNNER_TEMP}/signed-jars"
3932 mkdir -p "$SIGNED_JARS_DIR"
33+ echo "Signed JAR directory: ${SIGNED_JARS_DIR}"
34+
35+ # Export SIGNED_JARS_DIR as an output
36+ echo "::set-output name=signed_jars_dir::$SIGNED_JARS_DIR"
4037
41- # Step 3: Extract, sign native libraries, repackage, and sign the JARs with Apple codesign
38+ # Define LIB_DIR for JARs
39+ LIB_DIR="${PWD}/BUNDLES/com.espressif.idf.serial.monitor/lib"
40+
41+ # Sign the JARs
4242 for jar in "${LIB_DIR}"/*.jar; do
4343 echo "Processing JAR file: ${jar}"
4444
@@ -54,37 +54,39 @@ jobs:
5454 TEMP_DIR=$(mktemp -d)
5555 unzip -q "$jar" -d "$TEMP_DIR"
5656
57- # Find and sign all .jnilib and .dylib files in the extracted JAR directory
57+ # Sign any native libraries found in the JAR
5858 find "$TEMP_DIR" -name "*.jnilib" -o -name "*.dylib" | while read lib; do
5959 echo "Signing native library: ${lib}"
6060 /usr/bin/codesign -vvvv --entitlements $PWD/releng/com.espressif.idf.product/entitlements/espressif-ide.entitlement --options runtime --force -s "ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD. (QWXF6GB4AV)" --timestamp --deep "$lib"
6161 done
6262
63- # Repackage the signed JAR
63+ # Repackage the signed JAR and save it to SIGNED_JARS_DIR
6464 pushd "$TEMP_DIR"
65- zip -r "${SIGNED_JARS_DIR}/$(basename "$jar")" * # Save signed JAR to the temporary signed directory
65+ zip -r "${SIGNED_JARS_DIR}/$(basename "$jar")" *
6666 popd
6767
68- # Sign the entire JAR with Apple codesign, using the same entitlements
68+ # Sign the entire JAR
6969 echo "Signing repackaged JAR: ${SIGNED_JARS_DIR}/$(basename "$jar")"
7070 /usr/bin/codesign -vvvv --entitlements $PWD/releng/com.espressif.idf.product/entitlements/espressif-ide.entitlement --force --deep --options runtime --timestamp -s "ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD. (QWXF6GB4AV)" "${SIGNED_JARS_DIR}/$(basename "$jar")"
7171
7272 # Verify the signed JAR
7373 echo "Verifying signed JAR: ${SIGNED_JARS_DIR}/$(basename "$jar")"
7474 /usr/bin/codesign -dvv "${SIGNED_JARS_DIR}/$(basename "$jar")"
75-
76- # Clean up extracted directory (but leave the signed JAR in SIGNED_JARS_DIR)
75+
76+ # Clean up the temporary extraction directory
7777 rm -rf "$TEMP_DIR"
7878 done
7979
80+ # Step 2: Check if signed JAR files exist, using the output of the previous step
8081 - name : Check if signed JAR files exist
8182 run : |
82- echo "Checking signed JAR files in ${SIGNED_JARS_DIR }:"
83- ls -al ${SIGNED_JARS_DIR }
83+ echo "Checking signed JAR files in ${{ steps.sign_jars.outputs.signed_jars_dir } }:"
84+ ls -al ${{ steps.sign_jars.outputs.signed_jars_dir } }
8485
86+ # Step 3: Upload signed JAR files, using the output of the previous step
8587 - name : Upload Signed JAR Files
8688 if : ${{ !cancelled() }}
8789 uses : actions/upload-artifact@v4
8890 with :
8991 name : signed-jar-files
90- path : ${{ runner.temp }}/signed-jars /*
92+ path : ${{ steps.sign_jars.outputs.signed_jars_dir }}/*
0 commit comments