3333 /usr/bin/security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
3434 /usr/bin/security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k espressif build.keychain
3535
36- # Step 2: Define the directory containing the JARs and native libraries
36+ # Step 2: Define the directory containing the JARs and native libraries and the temp directory for signed JARs
3737 LIB_DIR="${PWD}/BUNDLES/com.espressif.idf.serial.monitor/lib"
38+ SIGNED_JARS_DIR=$(mktemp -d) # Create a temporary directory for signed JARs
3839
3940 # Step 3: Extract, sign native libraries, repackage, and sign the JARs with Apple codesign
4041 for jar in "${LIB_DIR}"/*.jar; do
@@ -60,29 +61,29 @@ jobs:
6061
6162 # Repackage the signed JAR
6263 pushd "$TEMP_DIR"
63- zip -r "$jar" *
64+ zip -r "${SIGNED_JARS_DIR}/$(basename "$ jar")" * # Save signed JAR to temporary directory
6465 popd
6566
6667 # Sign the entire JAR with Apple codesign, using the same entitlements
67- echo "Signing repackaged JAR: ${jar} "
68- /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)" "$jar"
68+ echo "Signing repackaged JAR: ${SIGNED_JARS_DIR}/$(basename "$jar") "
69+ /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") "
6970
7071 # Verify the signed JAR
71- echo "Verifying signed JAR: ${jar} "
72- /usr/bin/codesign -dvv "$jar"
72+ echo "Verifying signed JAR: ${SIGNED_JARS_DIR}/$(basename "$jar") "
73+ /usr/bin/codesign -dvv "${SIGNED_JARS_DIR}/$(basename "$ jar") "
7374
7475 # Clean up temporary directory
7576 rm -rf "$TEMP_DIR"
7677 done
7778
7879 - name : Check if signed JAR files exist
7980 run : |
80- echo "Checking signed JAR files in ${LIB_DIR }:"
81- ls -al ${LIB_DIR }
81+ echo "Checking signed JAR files in ${SIGNED_JARS_DIR }:"
82+ ls -al ${SIGNED_JARS_DIR }
8283
8384 - name : Upload Signed JAR Files
8485 if : ${{ !cancelled() }}
8586 uses : actions/upload-artifact@v4
8687 with :
8788 name : signed-jar-files
88- path : BUNDLES/com.espressif.idf.serial.monitor/lib/*.jar
89+ path : ${{ runner.temp }}/signed-jars/*
0 commit comments