Build Electron Demo #36
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 Electron Demo | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| inputs: | |
| production_build: | |
| description: Run a production-signed build and upload results as workflow artifacts | |
| required: false | |
| default: false | |
| type: boolean | |
| sign_windows_release: | |
| description: Require Windows Azure Artifact Signing for this run | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| prepare-release: | |
| name: Prepare Release Metadata | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.meta.outputs.version }} | |
| is_production_build: ${{ steps.meta.outputs.is_production_build }} | |
| steps: | |
| - name: Resolve version from release drafter | |
| id: draft | |
| if: github.ref == 'refs/heads/main' | |
| uses: release-drafter/release-drafter@v7 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Resolve release metadata | |
| id: meta | |
| shell: bash | |
| env: | |
| DRAFT_VERSION: ${{ steps.draft.outputs.resolved_version || '' }} | |
| MANUAL_PRODUCTION_BUILD: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.production_build == 'true' && 'true' || 'false' }} | |
| run: | | |
| set -euo pipefail | |
| package_version='0.0.0' | |
| if [[ -f package.json ]]; then | |
| package_version="$(node -p "require('./package.json').version")" | |
| fi | |
| version="${package_version}" | |
| is_production_build='false' | |
| if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then | |
| version="${GITHUB_REF_NAME#v}" | |
| is_production_build='true' | |
| elif [[ "${GITHUB_REF}" == 'refs/heads/main' && -n "${DRAFT_VERSION}" ]]; then | |
| version="${DRAFT_VERSION}" | |
| fi | |
| if [[ "${MANUAL_PRODUCTION_BUILD}" == 'true' ]]; then | |
| is_production_build='true' | |
| fi | |
| echo "version=${version}" >> "$GITHUB_OUTPUT" | |
| echo "is_production_build=${is_production_build}" >> "$GITHUB_OUTPUT" | |
| build-windows: | |
| name: Build Windows Packages | |
| needs: prepare-release | |
| uses: ./.github/workflows/reusable-build-windows.yml | |
| with: | |
| version: ${{ needs.prepare-release.outputs.version }} | |
| is_production_build: ${{ needs.prepare-release.outputs.is_production_build == 'true' }} | |
| sign_windows_release: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.sign_windows_release == 'true' }} | |
| publish_release_assets: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| secrets: inherit | |
| build-unix: | |
| name: Build Linux and macOS Packages | |
| needs: prepare-release | |
| uses: ./.github/workflows/reusable-build-unix.yml | |
| with: | |
| version: ${{ needs.prepare-release.outputs.version }} | |
| is_production_build: ${{ needs.prepare-release.outputs.is_production_build == 'true' }} | |
| publish_release_assets: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| secrets: inherit |