forked from microbit-foundation/cctd-ml-machine
-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (63 loc) · 2.63 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
env:
AWS_DEFAULT_REGION: eu-west-1
PRODUCTION_CLOUDFRONT_DISTRIBUTION_ID: EDKYRQ3JZCXQ5
STAGING_CLOUDFRONT_DISTRIBUTION_ID: E37K3V5Y65XQIX
REVIEW_CLOUDFRONT_DISTRIBUTION_ID: E3KUGPF02I4CJ4
VITE_FOUNDATION_BUILD: ${{ github.repository_owner == 'microbit-foundation' }}
# Not really secret but worth keeping out the repo to prevent unintended use
VITE_SENTRY_DSN: ${{ secrets.PROTOTYPE_SENTRY_DSN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
cache: "npm"
registry-url: "https://npm.pkg.github.com"
- uses: microbit-foundation/npm-package-versioner-action@v1
- 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]
if: github.repository_owner == 'microbit-foundation'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: node ./bin/print-ci-env.cjs >> $GITHUB_ENV
- run: npm run ci
- name: Run Playwright tests
if: env.STAGE == 'REVIEW' || env.STAGE == 'STAGING'
uses: docker://mcr.microsoft.com/playwright:v1.45.0-jammy
with:
args: npx playwright test
- name: Store reports
if: (env.STAGE == 'REVIEW' || env.STAGE == 'STAGING') && failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 3
- run: npx website-deploy-aws
if: github.repository_owner == 'microbit-foundation' && (env.STAGE == 'REVIEW' || success())
env:
AWS_ACCESS_KEY_ID: ${{ secrets.WEB_DEPLOY_ML_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.WEB_DEPLOY_ML_AWS_SECRET_ACCESS_KEY }}
- run: npx invalidate-cloudfront-distribution
if: github.repository_owner == 'microbit-foundation' && (env.STAGE == 'REVIEW' || success())
env:
AWS_ACCESS_KEY_ID: ${{ secrets.WEB_DEPLOY_ML_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.WEB_DEPLOY_ML_AWS_SECRET_ACCESS_KEY }}