feat: Windows Signing #104
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: Publish | |
| permissions: | |
| contents: write | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - windowsSigning | |
| jobs: | |
| build-and-publish: | |
| if: ${{ github.repository_owner == 'platinum-hill' }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| platform: win | |
| - os: macos-latest | |
| platform: mac | |
| - os: ubuntu-latest | |
| platform: linux | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout git repo | |
| uses: actions/checkout@v3 | |
| - name: Install Node and NPM | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 22.14.0 | |
| cache: npm | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install setuptools wheel | |
| - name: Install and build | |
| run: | | |
| npm install | |
| npm run postinstall | |
| npm run build | |
| - name: Publish Windows release | |
| if: matrix.platform == 'win' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: npm exec electron-builder -- --publish --win | |
| - name: Publish macOS release | |
| if: matrix.platform == 'mac' | |
| env: | |
| APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_ID_PASS }} | |
| APPLE_ID: ${{ secrets.APPLE_ID }} | |
| APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
| CSC_LINK: ${{ secrets.CSC_LINK }} | |
| CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: npm exec electron-builder -- --publish always --mac --linux | |
| - name: Publish Linux release | |
| if: matrix.platform == 'linux' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: npm exec electron-builder -- --publish always --linux | |
| - name: Get package version | |
| if: matrix.platform == 'win' | |
| id: get-version | |
| shell: bash | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "artifact-name=Cobolt-Setup-$VERSION.exe" >> $GITHUB_OUTPUT | |
| - name: Check if release already exists | |
| if: matrix.platform == 'win' | |
| id: check-release | |
| shell: bash | |
| run: | | |
| RELEASE_EXISTS=$(gh release view "v${{ steps.get-version.outputs.version }}" --json assets --jq '.assets | map(select(.name == "${{ steps.get-version.outputs.artifact-name }}")) | length' 2>/dev/null || echo "0") | |
| echo "release-exists=$RELEASE_EXISTS" >> $GITHUB_OUTPUT | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: upload-unsigned-artifact | |
| id: upload-unsigned-artifact | |
| if: matrix.platform == 'win' && steps.check-release.outputs.release-exists == '0' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: unsigned-intaller | |
| retention-days: 1 | |
| path: CoboltSetup\output\CoboltSetup_${{ steps.get-version.outputs.version }}.exe | |
| - name: Sign artifact | |
| if: matrix.platform == 'win' && steps.check-release.outputs.release-exists == '0' | |
| uses: signpath/github-action-submit-signing-request@v1.1 | |
| with: | |
| api-token: ${{secrets.SIGNPATH_API_TOKEN}} | |
| organization-id: 3fe5dc9d-e6f6-4c25-83e5-70c5844441b9 | |
| project-slug: cobolt | |
| signing-policy-slug: test-signing | |
| github-artifact-id: ${{steps.upload-unsigned-artifact.outputs.artifact-id}} | |
| wait-for-completion: true |