Skip to content

Commit 2e1f6a3

Browse files
Revert "attempt sign of all windows files"
This reverts commit 9c99895.
1 parent 9c99895 commit 2e1f6a3

File tree

2 files changed

+29
-54
lines changed

2 files changed

+29
-54
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,12 @@ env:
7575
artifacts:
7676
- path: '*Windows_64bit.exe'
7777
name: Windows_X86-64_interactive_installer
78-
- path: '*Windows_64bit_unsigned.exe'
79-
name: Windows_X86-64_interactive_installer_unsigned
78+
- path: '*Windows_64bit_signed.exe'
79+
name: Windows_X86-64_interactive_installer_signed
8080
- path: '*Windows_64bit.msi'
8181
name: Windows_X86-64_MSI
82-
- path: '*Windows_64bit_unsigned.msi'
83-
name: Windows_X86-64_MSI_unsigned
8482
- path: '*Windows_64bit.zip'
8583
name: Windows_X86-64_zip
86-
- path: '*Windows_64bit_unsigned.zip'
87-
name: Windows_X86-64_zip_unsigned
8884
- config:
8985
name: Linux
9086
runs-on: ubuntu-latest
@@ -437,59 +433,38 @@ jobs:
437433
name: ${{ env.JOB_TRANSFER_ARTIFACT }}
438434
path: ${{ env.BUILD_ARTIFACTS_PATH }}
439435

440-
- name: Find and process artifacts
436+
- name: Save artifact path to variable
441437
shell: bash
442438
run: |
443-
shopt -s nullglob
444-
for ARTIFACT in "${{ env.BUILD_ARTIFACTS_PATH }}"/*_unsigned.{exe,zip,msi}; do
445-
echo "Processing $ARTIFACT"
446-
FILENAME=$(basename "$ARTIFACT")
447-
BASE_NAME="${FILENAME%.*}"
448-
EXTENSION="${FILENAME##*.}"
449-
# Remove '_unsigned' from the base name
450-
SIGNED_BASE_NAME="${BASE_NAME%_unsigned}"
451-
452-
# Sign and rename EXE and MSI files
453-
if [[ "$EXTENSION" == "exe" || "$EXTENSION" == "msi" ]]; then
454-
echo "Signing $ARTIFACT"
455-
"${{ env.SIGNTOOL_PATH }}" sign -d "Arduino IDE" -f ${{ env.INSTALLER_CERT_WINDOWS_CER }} -csp "eToken Base Cryptographic Provider" -k "[{{${{ env.CERT_PASSWORD }}}}]=${{ env.CONTAINER_NAME }}" -fd sha256 -tr http://timestamp.digicert.com -td SHA256 -v "$ARTIFACT"
456-
SIGNED_ARTIFACT_PATH="${{ env.BUILD_ARTIFACTS_PATH }}/${SIGNED_BASE_NAME}.${EXTENSION}"
457-
mv "$ARTIFACT" "$SIGNED_ARTIFACT_PATH"
458-
echo "Renamed $ARTIFACT to $SIGNED_ARTIFACT_PATH"
459-
fi
460-
461-
# Unzip, Sign, and Rezip ZIP file without '_unsigned' in the name
462-
if [[ "$EXTENSION" == "zip" ]]; then
463-
TEMP_DIR=$(mktemp -d)
464-
unzip "$ARTIFACT" -d "$TEMP_DIR"
465-
find "$TEMP_DIR" -type f -name '*.exe' -exec "${{ env.SIGNTOOL_PATH }}" sign -d "Arduino IDE" -f ${{ env.INSTALLER_CERT_WINDOWS_CER }} -csp "eToken Base Cryptographic Provider" -k "[{{${{ env.CERT_PASSWORD }}}}]=${{ env.CONTAINER_NAME }}" -fd sha256 -tr http://timestamp.digicert.com -td SHA256 -v {} \;
466-
SIGNED_ARTIFACT_PATH="${{ env.BUILD_ARTIFACTS_PATH }}/${SIGNED_BASE_NAME}.${EXTENSION}"
467-
pushd "$TEMP_DIR"
468-
zip -r "$SIGNED_ARTIFACT_PATH" .
469-
popd
470-
rm -rf "$TEMP_DIR"
471-
echo "Processed and re-zipped $ARTIFACT"
472-
fi
473-
done
439+
ARTIFACT=$(find "${{ env.BUILD_ARTIFACTS_PATH }}" -name "*Windows_64bit.exe" | head -n 1)
440+
# Convert to Windows-style path with forward slashes
441+
FULL_PATH=$(cygpath -w $ARTIFACT | sed 's|\\|/|g')
442+
echo "ARTIFACT_PATH=$FULL_PATH" >> $GITHUB_ENV
474443
475-
- name: Upload signed EXE
476-
uses: actions/upload-artifact@v3
477-
with:
478-
name: Windows_X86-64_interactive_installer
479-
path: ${{ env.BUILD_ARTIFACTS_PATH }}/*Windows_64bit.exe
444+
- name: Save Win signing certificate to file
445+
run: echo "${{ secrets.INSTALLER_CERT_WINDOWS_CER }}" | base64 --decode > ${{ env.INSTALLER_CERT_WINDOWS_CER }}
480446

481-
- name: Upload signed MSI
482-
uses: actions/upload-artifact@v3
483-
with:
484-
name: Windows_X86-64_MSI
485-
path: ${{ env.BUILD_ARTIFACTS_PATH }}/*Windows_64bit.msi
486-
487-
488-
- name: Upload signed ZIP
447+
- name: Sign EXE
448+
env:
449+
CERT_PASSWORD: ${{ secrets.INSTALLER_CERT_WINDOWS_PASSWORD }}
450+
CONTAINER_NAME: ${{ secrets.INSTALLER_CERT_WINDOWS_CONTAINER }}
451+
# https://stackoverflow.com/questions/17927895/automate-extended-validation-ev-code-signing-with-safenet-etoken
452+
run: |
453+
"${{ env.SIGNTOOL_PATH }}" sign -d "Arduino IDE" -f ${{ env.INSTALLER_CERT_WINDOWS_CER }} -csp "eToken Base Cryptographic Provider" -k "[{{${{ env.CERT_PASSWORD }}}}]=${{ env.CONTAINER_NAME }}" -fd sha256 -tr http://timestamp.digicert.com -td SHA256 -v ${{ env.ARTIFACT_PATH }}
454+
455+
- name: Rename signed EXE
456+
shell: bash
457+
run: |
458+
BASE_NAME=$(echo "${{ env.ARTIFACT_PATH }}" | sed 's/.exe$//')
459+
SIGNED_EXE_PATH="${BASE_NAME}_signed.exe"
460+
mv "${{ env.ARTIFACT_PATH }}" "$SIGNED_EXE_PATH"
461+
echo "SIGNED_ARTIFACT_PATH=$SIGNED_EXE_PATH" >> $GITHUB_ENV
462+
463+
- name: Upload artifacts with signed EXE
489464
uses: actions/upload-artifact@v3
490465
with:
491-
name: Windows_X86-64_zip
492-
path: ${{ env.BUILD_ARTIFACTS_PATH }}/*Windows_64bit.zip
466+
name: Windows_X86-64_interactive_installer_signed
467+
path: ${{ env.SIGNED_ARTIFACT_PATH }}
493468

494469
# This step is needed because the self hosted runner does not delete files automatically
495470
- name: Clean up artifacts

electron-app/scripts/package.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ async function getArtifactName(version) {
100100
switch (platform) {
101101
case 'win32': {
102102
if (arch === 'x64') {
103-
return `${name}_${version}_Windows_64bit_unsigned.\$\{ext}`;
103+
return `${name}_${version}_Windows_64bit.\$\{ext}`;
104104
}
105105
throw new Error(`Unsupported platform, arch: ${platform}, ${arch}`);
106106
}

0 commit comments

Comments
 (0)