Use the right node version #474
Workflow file for this run
This file contains 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 | |
on: | |
release: | |
types: [created] | |
push: | |
branches: | |
- "**" | |
concurrency: | |
group: ${{ github.workflow }}-${{ startsWith(github.ref, 'refs/tags/v') && 'release' || github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/v') }} | |
jobs: | |
build: | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: read | |
env: | |
AWS_DEFAULT_REGION: eu-west-1 | |
PRODUCTION_CLOUDFRONT_DISTRIBUTION_ID: E2ELTBTA2OFPY2 | |
STAGING_CLOUDFRONT_DISTRIBUTION_ID: E2ELTBTA2OFPY2 | |
REVIEW_CLOUDFRONT_DISTRIBUTION_ID: E3267W09ZJHQG9 | |
VITE_FOUNDATION_BUILD: ${{ github.repository_owner == 'microbit-foundation' }} | |
# This feature is also controlled by a client-side feature flag that is disabled by default for the moment | |
FEATURE_PWA: ${{ github.repository_owner == 'microbit-foundation' }} | |
steps: | |
# Note: This workflow disables deployment steps and micro:bit branding installation on forks. | |
- uses: actions/checkout@v4 | |
- name: Configure node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
cache: "npm" | |
registry-url: "https://npm.pkg.github.com" | |
- run: npm ci | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: npm install --no-save @microbit-foundation/[email protected] @microbit-foundation/[email protected] @microbit-foundation/[email protected] @microbit-foundation/circleci-npm-package-versioner@1 | |
if: github.repository_owner == 'microbit-foundation' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: node ./bin/print-ci-env-stage.cjs >> $GITHUB_ENV | |
- run: node ./bin/print-ci-env-public-url.cjs >> $GITHUB_ENV | |
- run: npm run ci:update-version | |
if: github.repository_owner == 'microbit-foundation' | |
- run: npm run ci | |
env: | |
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
- run: mkdir -p /tmp/app${BASE_URL} && cp -r build/* /tmp/app${BASE_URL} && npx serve --no-clipboard -l 3000 /tmp/app & | |
if: env.STAGE == 'REVIEW' || env.STAGE == 'STAGING' | |
- run: curl --insecure -4 --retry 7 --retry-connrefused http://localhost:3000 1>/dev/null | |
if: env.STAGE == 'REVIEW' || env.STAGE == 'STAGING' | |
- name: Run Playwright tests | |
if: env.STAGE == 'REVIEW' || env.STAGE == 'STAGING' | |
uses: docker://mcr.microsoft.com/playwright:v1.42.1-jammy | |
with: | |
args: npx playwright test | |
- name: Store reports | |
if: (env.STAGE == 'REVIEW' || env.STAGE == 'STAGING') && failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: reports | |
path: reports/ | |
retention-days: 3 | |
- run: npm run deploy | |
if: github.repository_owner == 'microbit-foundation' && (env.STAGE == 'REVIEW' || success()) | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.WEB_DEPLOY_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.WEB_DEPLOY_AWS_SECRET_ACCESS_KEY }} | |
- run: npm run invalidate | |
if: github.repository_owner == 'microbit-foundation' && (env.STAGE == 'REVIEW' || success()) | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.WEB_DEPLOY_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.WEB_DEPLOY_AWS_SECRET_ACCESS_KEY }} |