Fix some settings and toolkit tests #108
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: | |
workflow_dispatch: | |
release: | |
types: [created] | |
repository_dispatch: | |
types: [new_theme_released] | |
push: | |
branches: | |
- "feature/*" | |
- "main" | |
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 | |
steps: | |
# Note: This workflow disables deployment steps and micro:bit branding installation on forks. | |
- uses: actions/checkout@v3 | |
- name: Configure node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: "npm" | |
registry-url: "https://npm.pkg.github.com" | |
scope: "@calliope-edu" | |
- run: npm ci | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: npm install --no-save @calliope-edu/calliope-theme @calliope-edu/website-deploy-aws-config #@microbit-foundation/[email protected] @microbit-foundation/circleci-npm-package-versioner@1 | |
if: github.repository_owner == 'calliope-edu' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: node ./bin/print-ci-env-stage.js >> $GITHUB_ENV | |
- run: node ./bin/print-ci-env-public-url.js >> $GITHUB_ENV | |
# - run: npm run ci:update-version | |
# if: github.repository_owner == 'calliope-edu' | |
- run: npm run build | |
if: github.repository_owner == 'calliope-edu' | |
# env: | |
# REACT_APP_GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }} | |
# REACT_APP_GA_COOKIE_PREFIX: ${{ secrets.REACT_APP_GA_COOKIE_PREFIX }} | |
- run: mkdir -p /tmp/app${PUBLIC_URL} && cp -r build/* /tmp/app${PUBLIC_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' | |
- run: npm run test:e2e:headless | |
if: env.STAGE == 'REVIEW' || env.STAGE == 'STAGING' | |
- name: Store reports | |
if: (env.STAGE == 'REVIEW' || env.STAGE == 'STAGING') && failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: reports | |
path: reports/ | |
- name: Deploy static site to S3 bucket | |
run: aws s3 sync ./build/ s3://${{ env.DEPLOY_PATH }} --delete | |
if: github.repository_owner == 'calliope-edu' && (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 }} | |
- name: Invalidate CloudFront | |
uses: chetan/invalidate-cloudfront-action@v2 | |
env: | |
DISTRIBUTION: ${{ env.DISTRIBUTION_ID }} | |
PATHS: "/*" | |
AWS_REGION: "eu-central-1" | |
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 == 'calliope-edu' && (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 }} |