Build: Sign Windows executable with CodeSignTool #10
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Release | |
| on: | |
| push: | |
| tags: | |
| - "*.*.*" | |
| permissions: | |
| id-token: write | |
| jobs: | |
| build: | |
| name: "Build" | |
| uses: ./.github/workflows/build-workflow.yml | |
| secrets: inherit | |
| sign-macos: | |
| name: Sign & Notarize macOS app | |
| runs-on: macos-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: macOS Installer (Unsigned) | |
| path: scripts | |
| - name: List | |
| run: ls | |
| working-directory: scripts | |
| - name: Install the Apple certificate and provisioning profile | |
| env: | |
| BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | |
| P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | |
| KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
| run: | | |
| # create variables | |
| CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
| KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
| # import certificate from secret | |
| echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH | |
| # create temporary keychain | |
| security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
| security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | |
| security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
| # import certificate to keychain | |
| security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
| security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
| security list-keychain -d user -s $KEYCHAIN_PATH | |
| - name: Sign the .app | |
| env: | |
| IDENTITY: ${{ secrets.IDENTITY }} # "identity" | |
| USERNAME: ${{ secrets.USERNAME }} # "apple-id email" | |
| PASSWORD: ${{ secrets.PASSWORD }} # "apple-id app specific password (go to https://appleid.apple.com./)" | |
| TEAM_ID: ${{ secrets.TEAM_ID }} # "developer team id" | |
| VERSION: ${{ github.ref_name }} # "1.0.0" | |
| run: | | |
| chmod +x ./sign-macos-app.sh | |
| ./sign-macos-app.sh | |
| working-directory: scripts | |
| - name: "Upload Signed App" | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macOS Installer | |
| path: scripts/*.app.zip | |
| sign-windows: | |
| name: Sign Windows executable | |
| runs-on: windows-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Azure login | |
| uses: azure/login@v1 | |
| with: | |
| client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| - name: Create Temp Directory | |
| run: mkdir dist | |
| shell: cmd | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: Windows Installer (Unsigned) | |
| path: dist | |
| - name: List | |
| run: | | |
| dir | |
| echo %cd% | |
| shell: cmd | |
| working-directory: dist | |
| - name: Sign Artifact with CodeSignTool | |
| uses: sslcom/esigner-codesign@b7f8ff36fc0de8690fbbab8e5b4421d29802f747 # v1.3.2 | |
| with: | |
| command: sign | |
| username: ${{secrets.ESSENTIAL_CODESIGN_USERNAME}} | |
| password: ${{secrets.ESSENTIAL_CODESIGN_PASSWORD}} | |
| credential_id: ${{secrets.ESSENTIAL_CODESIGN_CREDENTIAL_ID}} | |
| totp_secret: ${{secrets.ESSENTIAL_CODESIGN_TOTP_SECRET}} | |
| file_path: ${{ github.workspace }}\dist\installer-wrapper.exe | |
| override: true | |
| - name: Rename executable | |
| env: | |
| VERSION: ${{ github.ref_name }} | |
| run: | | |
| BRAND_LOWERCASE=$(cat ../wrapper/resources/info/brand.txt | tr '[:upper:]' '[:lower:]') | |
| echo "Renaming to $BRAND_LOWERCASE-installer-$VERSION.exe" | |
| mv installer-wrapper.exe "$BRAND_LOWERCASE-installer-$VERSION.exe" | |
| shell: bash | |
| working-directory: dist | |
| - name: "Upload Signed Executable" | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Windows Installer | |
| path: dist/*.exe | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| needs: | |
| - sign-macos | |
| - sign-windows | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: Windows Installer | |
| path: scripts | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: macOS Installer | |
| path: scripts | |
| - name: Release | |
| env: | |
| VERSION: ${{ github.ref_name }} | |
| RELEASE_USER: ${{ secrets.RELEASE_USER }} | |
| RELEASE_PASSWORD: ${{ secrets.RELEASE_PASSWORD }} | |
| run: ./upload-all.sh | |
| working-directory: scripts |