name: Build Element Call on: workflow_call: inputs: vite_app_version: required: true type: string package: type: string # This would ideally be a `choice` type, but that isn't supported yet description: The package type to be built. Must be one of 'full', 'embedded', or 'sdk' required: true build_mode: type: string # This would ideally be a `choice` type, but that isn't supported yet description: The build mode for vite. Must be either 'development' or 'production' required: false default: production # No `secrets:` block: every caller passes `secrets: inherit`, so the # repository's secrets reach this workflow without each one being declared # here and threaded through by name at the call sites -- the same pattern # build-and-publish-docker.yaml uses. A secret this workflow starts using # then needs no change to the callers. The ones read below are # MATRIX_RTC_NPM_TOKEN, SENTRY_ORG, SENTRY_PROJECT, SENTRY_URL, # SENTRY_AUTH_TOKEN and CODECOV_TOKEN. jobs: build: name: Build Element Call runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 with: persist-credentials: false - name: Enable Corepack run: corepack enable - name: pnpm cache uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: cache: "pnpm" node-version-file: ".node-version" - name: Authenticate to GitHub Packages # The MatrixRTC SDK (@billcarsonfr/matrix-rtc, see .npmrc) is on the GitHub # Packages npm registry, which needs a token with read:packages even for # public packages. A workflow's GITHUB_TOKEN only reaches packages of its own # repository, so this is a personal access token kept as a repository secret. env: NPM_REGISTRY_TOKEN: ${{ secrets.MATRIX_RTC_NPM_TOKEN }} run: echo "//npm.pkg.github.com/:_authToken=${NPM_REGISTRY_TOKEN}" >> ~/.npmrc - name: Install dependencies # ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present) run: "pnpm install --frozen-lockfile --ignore-pnpmfile" - name: Build Element Call run: pnpm run build:"$PACKAGE":"$BUILD_MODE" env: SENTRY_ORG: ${{ secrets.SENTRY_ORG }} SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} SENTRY_URL: ${{ secrets.SENTRY_URL }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} VITE_APP_VERSION: ${{ inputs.vite_app_version }} NODE_OPTIONS: "--max-old-space-size=4096" PACKAGE: ${{ inputs.package }} BUILD_MODE: ${{ inputs.build_mode }} - name: Upload Artifact uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: build-output-${{ inputs.package }} path: dist # We'll only use this in a triggered job, then we're done with it retention-days: 1