name: Website on: push: # Stable release tags only (`v8.0.2`, not `v8.1.0-beta.0`): filter patterns # must match the whole tag, so prerelease suffixes are excluded. tags: - 'v[0-9]+.[0-9]+.[0-9]+' # Re-publish without cutting a release. Run it from a stable release tag (the # `website-publish` environment only admits `v*` tags). workflow_dispatch: pull_request: paths: - 'docs/**' - 'website/**' # The API reference is generated from the compiled packages: their # sources, manifests, READMEs and tsconfigs, the release version and # the root toolchain all change its output. - 'packages/**/src/**' - 'packages/**/package.json' - 'packages/**/README.md' - 'packages/**/tsconfig*.json' - 'typedoc.jsonc' - 'lerna.json' - 'package.json' - 'yarn.lock' - '.github/workflows/website.yml' permissions: contents: read concurrency: # Keyed on the event too, so a pull request can never share (and cancel) # the group of a tag's publish run, whatever its branch is called. group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: build: name: Build forge.electronjs.org runs-on: ubuntu-22.04 defaults: run: working-directory: website steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup Node.js uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version-file: .nvmrc package-manager-cache: false # publishing job: keep the release build cache-free # The API reference at /api is generated by TypeDoc from the packages' # compiled output (entry points and declaration maps in dist/). - name: Install root dependencies working-directory: . run: yarn install --immutable - name: Compile packages working-directory: . run: yarn tsc -b packages - name: Install dependencies run: yarn install --immutable - name: Type-check website run: yarn tsc - name: Build website run: yarn build - name: Upload website build uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: website path: website/build deploy: name: Publish forge.electronjs.org needs: build # Publishes from stable version tags only, on release or manual dispatch if: >- (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') && github.repository == 'electron/forge' runs-on: ubuntu-latest # Holds the OIDC federated credential for the forge.electronjs.org storage # account; its deployment policy only allows tags matching `v*` environment: website-publish permissions: contents: read id-token: write # for azure/login concurrency: group: forge-website-deploy cancel-in-progress: false steps: - name: Download website build uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: website path: website/build - name: Azure login uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0 with: client-id: ${{ secrets.AZURE_FORGE_WEBSITE_OIDC_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_OIDC_TENANT_ID }} subscription-id: ${{ secrets.AZURE_OIDC_SUBSCRIPTION_ID }} - name: Sync to Azure Blob Storage env: AZCOPY_AUTO_LOGIN_TYPE: AZCLI STORAGE_ACCOUNT: ${{ secrets.AZURE_FORGE_WEBSITE_STORAGE_ACCOUNT_NAME }} run: | set -eo pipefail test -f website/build/index.html # The static website container is `$web`; `%24` keeps the shell out of it azcopy sync ./website/build "https://${STORAGE_ACCOUNT}.blob.core.windows.net/%24web/" --delete-destination=true --compare-hash=MD5 - name: Upload azcopy debug logs if: failure() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: azcopy-log path: /home/runner/.azcopy/*.log include-hidden-files: true retention-days: 3