Skip to content

Commit

Permalink
Migrate to GitHub actions (#98)
Browse files Browse the repository at this point in the history
Sticking with Node 14 for now to match Emscripten.
  • Loading branch information
microbit-matt-hillsdon authored Feb 6, 2023
1 parent 19afbf0 commit fc2093b
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 143 deletions.
143 changes: 0 additions & 143 deletions .circleci/config.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: build

on:
release:
types: [created]
push:
branches:
- "**"

# This is conservative: ideally we'd include branch and stage in this key
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency: deploy-python-simulator

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
env:
AWS_DEFAULT_REGION: eu-west-1
PRODUCTION_CLOUDFRONT_DISTRIBUTION_ID: E15FPP46STH15O
STAGING_CLOUDFRONT_DISTRIBUTION_ID: E15FPP46STH15O
REVIEW_CLOUDFRONT_DISTRIBUTION_ID: E2DW5F7PA9W7JD

steps:
# Note: This workflow will not run on forks without modification; we're open to making steps
# that rely on our deployment infrastructure conditional. Please open an issue.
- uses: actions/checkout@v3
- name: Configure node
uses: actions/setup-node@v3
with:
node-version: 14.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/circleci-npm-package-versioner@1
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: node ./bin/print-ci-env.js >> $GITHUB_ENV
- run: npm run ci:update-version
- run: ./ci-build.sh
- run: npm run deploy
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
env:
AWS_ACCESS_KEY_ID: ${{ secrets.WEB_DEPLOY_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.WEB_DEPLOY_AWS_SECRET_ACCESS_KEY }}
12 changes: 12 additions & 0 deletions .github/workflows/pr-url.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "pr-url"
on:
pull_request:
types: [opened]
jobs:
pr-url:
runs-on: ubuntu-latest
steps:
- uses: microbit-foundation/[email protected]
with:
uri-template: "https://review-python-simulator.usermbit.org/{branch}/"
repo-token: ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions bin/print-ci-env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env node
const ref = process.env.GITHUB_REF;
let stage;
if (ref === "refs/heads/main") {
stage = "STAGING";
} else if (ref.startsWith("refs/tags/v")) {
stage = "PRODUCTION";
} else {
stage = "REVIEW";
}

console.log(`STAGE=${stage}`);

0 comments on commit fc2093b

Please sign in to comment.