Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

sign mac and win workflow

Prateek Sunal9cbf682fd163
diff --git a/.github/workflows/ensu-release.yml b/.github/workflows/ensu-release.yml
index 6d88fbae87..636fba1a69 100644
--- a/.github/workflows/ensu-release.yml
+++ b/.github/workflows/ensu-release.yml
@@ -30,6 +30,9 @@ jobs:
rust-target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.platform.os }}
+ env:
+ HAS_MAC_SIGNING: ${{ secrets.MAC_OS_CERTIFICATE != '' && secrets.MAC_OS_CERTIFICATE_PASSWORD != '' && secrets.APPLE_ID != '' && secrets.APPLE_PASSWORD != '' && secrets.APPLE_TEAM_ID != '' }}
+ HAS_WINDOWS_SIGNING: ${{ secrets.AZURE_TENANT_ID != '' && secrets.AZURE_CLIENT_ID != '' && secrets.AZURE_CLIENT_SECRET != '' && secrets.AZURE_ENDPOINT != '' && secrets.AZURE_CODE_SIGNING_NAME != '' && secrets.AZURE_CERT_PROFILE_NAME != '' }}
steps:
- name: Checkout code
@@ -114,6 +117,116 @@ jobs:
prerelease: false
args: ${{ matrix.platform.rust-target != 'x86_64-unknown-linux-gnu' && format('--target {0}', matrix.platform.rust-target) || '' }}
+ - name: Install macOS signing dependencies
+ if: matrix.platform.os == 'macos-latest' && env.HAS_MAC_SIGNING == 'true'
+ run: |
+ pip3 install codemagic-cli-tools --break-system-packages
+ shell: bash
+
+ - name: Add macOS signing certificate
+ if: matrix.platform.os == 'macos-latest' && env.HAS_MAC_SIGNING == 'true'
+ run: |
+ CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
+ echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o "$CERTIFICATE_PATH"
+ keychain initialize
+ keychain add-certificates --certificate "$CERTIFICATE_PATH" --certificate-password "$P12_PASSWORD"
+ env:
+ BUILD_CERTIFICATE_BASE64: ${{ secrets.MAC_OS_CERTIFICATE }}
+ P12_PASSWORD: ${{ secrets.MAC_OS_CERTIFICATE_PASSWORD }}
+ shell: bash
+
+ - name: Locate macOS DMG
+ id: macos-dmg
+ if: matrix.platform.os == 'macos-latest' && env.HAS_MAC_SIGNING == 'true'
+ run: |
+ DMG_PATH=$(find "${{ github.workspace }}/rust/apps/ensu/src-tauri/target/${{ matrix.platform.rust-target }}/release/bundle" -type f -name "*.dmg" | head -n 1)
+ if [ -z "$DMG_PATH" ]; then
+ echo "No DMG artifact found"
+ exit 1
+ fi
+ echo "path=$DMG_PATH" >> "$GITHUB_OUTPUT"
+ echo "Found DMG: $DMG_PATH"
+ shell: bash
+
+ - name: Sign macOS DMG
+ if: matrix.platform.os == 'macos-latest' && env.HAS_MAC_SIGNING == 'true'
+ run: |
+ CERT_NAME=$(security find-identity -v -p codesigning | grep "Developer ID Application" | awk -F'"' '{print $2}' | grep -m1 "")
+ codesign --force --timestamp --sign "$CERT_NAME" --options runtime "${{ steps.macos-dmg.outputs.path }}"
+ codesign --verify --verbose=4 "${{ steps.macos-dmg.outputs.path }}"
+ shell: bash
+
+ - name: Notarize and staple DMG
+ if: matrix.platform.os == 'macos-latest' && env.HAS_MAC_SIGNING == 'true'
+ run: |
+ xcrun notarytool submit "${{ steps.macos-dmg.outputs.path }}" \
+ --wait \
+ --apple-id "$APPLE_ID" \
+ --password "$APPLE_PASSWORD" \
+ --team-id "$APPLE_TEAM_ID"
+ xcrun stapler staple "${{ steps.macos-dmg.outputs.path }}"
+ env:
+ APPLE_ID: ${{ secrets.APPLE_ID }}
+ APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
+ APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
+ shell: bash
+
+ - name: Upload signed macOS artifacts to draft GitHub release
+ if: matrix.platform.os == 'macos-latest' && env.HAS_MAC_SIGNING == 'true'
+ uses: ncipollo/release-action@v1
+ with:
+ tag: ${{ github.ref_name }}
+ artifacts: ${{ steps.macos-dmg.outputs.path }}
+ draft: true
+ allowUpdates: true
+ updateOnlyUnreleased: true
+
+ - name: Locate Windows signing artifacts
+ id: windows-signing-artifacts
+ if: matrix.platform.os == 'windows-latest' && env.HAS_WINDOWS_SIGNING == 'true'
+ shell: bash
+ run: |
+ ARTIFACT_DIR="${{ github.workspace }}/rust/apps/ensu/src-tauri/target/${{ matrix.platform.rust-target }}/release/bundle"
+ mapfile -t SIGN_FILES < <(find "$ARTIFACT_DIR" -type f \( -name "*.exe" -o -name "*.msi" \))
+
+ if [ "${#SIGN_FILES[@]}" -eq 0 ]; then
+ echo "No Windows executable/MSI artifacts found for signing"
+ exit 1
+ fi
+
+ {
+ echo "files<<EOF"
+ for file in "${SIGN_FILES[@]}"; do
+ echo "$file"
+ done
+ echo "EOF"
+ } >> "$GITHUB_OUTPUT"
+
+ - name: Sign files with Trusted Signing
+ if: matrix.platform.os == 'windows-latest' && env.HAS_WINDOWS_SIGNING == 'true'
+ uses: azure/trusted-signing-action@v0
+ with:
+ azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
+ azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
+ azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
+ endpoint: ${{ secrets.AZURE_ENDPOINT }}
+ trusted-signing-account-name: ${{ secrets.AZURE_CODE_SIGNING_NAME }}
+ certificate-profile-name: ${{ secrets.AZURE_CERT_PROFILE_NAME }}
+ files: ${{ steps.windows-signing-artifacts.outputs.files }}
+ file-digest: SHA256
+ timestamp-rfc3161: http://timestamp.acs.microsoft.com
+ timestamp-digest: SHA256
+
+ - name: Upload signed Windows artifacts to draft GitHub release
+ if: matrix.platform.os == 'windows-latest' && env.HAS_WINDOWS_SIGNING == 'true'
+ uses: ncipollo/release-action@v1
+ with:
+ tag: ${{ github.ref_name }}
+ artifacts: ${{ steps.windows-signing-artifacts.outputs.files }}
+ allowUpdates: true
+ draft: true
+ updateOnlyUnreleased: true
+
build-android:
runs-on: ubuntu-latest
needs: release-desktop