Skip to content

Commit fc2093b

Browse files
Migrate to GitHub actions (#98)
Sticking with Node 14 for now to match Emscripten.
1 parent 19afbf0 commit fc2093b

File tree

4 files changed

+76
-143
lines changed

4 files changed

+76
-143
lines changed

.circleci/config.yml

Lines changed: 0 additions & 143 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: build
2+
3+
on:
4+
release:
5+
types: [created]
6+
push:
7+
branches:
8+
- "**"
9+
10+
# This is conservative: ideally we'd include branch and stage in this key
11+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
12+
concurrency: deploy-python-simulator
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: read
20+
env:
21+
AWS_DEFAULT_REGION: eu-west-1
22+
PRODUCTION_CLOUDFRONT_DISTRIBUTION_ID: E15FPP46STH15O
23+
STAGING_CLOUDFRONT_DISTRIBUTION_ID: E15FPP46STH15O
24+
REVIEW_CLOUDFRONT_DISTRIBUTION_ID: E2DW5F7PA9W7JD
25+
26+
steps:
27+
# Note: This workflow will not run on forks without modification; we're open to making steps
28+
# that rely on our deployment infrastructure conditional. Please open an issue.
29+
- uses: actions/checkout@v3
30+
- name: Configure node
31+
uses: actions/setup-node@v3
32+
with:
33+
node-version: 14.x
34+
cache: "npm"
35+
registry-url: "https://npm.pkg.github.com"
36+
- run: npm ci
37+
env:
38+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
- run: npm install --no-save @microbit-foundation/[email protected] @microbit-foundation/[email protected] @microbit-foundation/circleci-npm-package-versioner@1
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
- run: node ./bin/print-ci-env.js >> $GITHUB_ENV
43+
- run: npm run ci:update-version
44+
- run: ./ci-build.sh
45+
- run: npm run deploy
46+
env:
47+
AWS_ACCESS_KEY_ID: ${{ secrets.WEB_DEPLOY_AWS_ACCESS_KEY_ID }}
48+
AWS_SECRET_ACCESS_KEY: ${{ secrets.WEB_DEPLOY_AWS_SECRET_ACCESS_KEY }}
49+
- run: npm run invalidate
50+
env:
51+
AWS_ACCESS_KEY_ID: ${{ secrets.WEB_DEPLOY_AWS_ACCESS_KEY_ID }}
52+
AWS_SECRET_ACCESS_KEY: ${{ secrets.WEB_DEPLOY_AWS_SECRET_ACCESS_KEY }}

.github/workflows/pr-url.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: "pr-url"
2+
on:
3+
pull_request:
4+
types: [opened]
5+
jobs:
6+
pr-url:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: microbit-foundation/[email protected]
10+
with:
11+
uri-template: "https://review-python-simulator.usermbit.org/{branch}/"
12+
repo-token: ${{ secrets.GITHUB_TOKEN }}

bin/print-ci-env.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env node
2+
const ref = process.env.GITHUB_REF;
3+
let stage;
4+
if (ref === "refs/heads/main") {
5+
stage = "STAGING";
6+
} else if (ref.startsWith("refs/tags/v")) {
7+
stage = "PRODUCTION";
8+
} else {
9+
stage = "REVIEW";
10+
}
11+
12+
console.log(`STAGE=${stage}`);

0 commit comments

Comments
 (0)