Skip to content

Commit 729c4eb

Browse files
fix: sign jars to avoid notorization issues
1 parent 459e2b9 commit 729c4eb

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/signjars.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Java CI with Maven
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: macos-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v3
19+
with:
20+
java-version: '17'
21+
distribution: 'temurin'
22+
23+
- name: Sign JARs
24+
run: |
25+
# Export secrets as environment variables
26+
export JARSIGNER_KEYSTORE_B64=${{ secrets.JARSIGNER_REL_KEYSTORE_B64 }}
27+
export JARSIGNER_STOREPASS=${{ secrets.JARSIGNER_REL_STOREPASS }}
28+
export JARSIGNER_ALIAS=${{ secrets.JARSIGNER_REL_ALIAS }}
29+
30+
# Set up the keystore file path
31+
KEYSTORE_FILE="${PWD}/{{secrets.JARSIGNER_KEYSTORE}}"
32+
echo "Keystore file: ${KEYSTORE_FILE}"
33+
34+
# Decode and save the base64-encoded keystore to the file
35+
printf "%s" "${JARSIGNER_KEYSTORE_B64}" | base64 -d > "${KEYSTORE_FILE}"
36+
37+
# Sign all JAR files located in the specified directory
38+
LIB_DIR="${PWD}/BUNDLES/com.espressif.idf.serial.monitor/lib"
39+
echo "Signing JAR files in ${LIB_DIR}"
40+
for jar in "${LIB_DIR}"/*.jar; do
41+
echo "Signing JAR file: ${jar}"
42+
jarsigner -keystore "${KEYSTORE_FILE}" \
43+
-storepass "${JARSIGNER_STOREPASS}" \
44+
-signedjar "${jar}" \
45+
"${jar}" "${JARSIGNER_ALIAS}"
46+
done
47+
48+
# Clean up the keystore file
49+
rm -v "${KEYSTORE_FILE}"
50+
51+
- name: Upload Signed JAR Files
52+
if: ${{ !cancelled() }}
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: signed-jar-files
56+
path: BUNDLES/com.espressif.idf.serial.monitor/lib/*.jar

0 commit comments

Comments
 (0)