From f4c20c589338fd4dd869a64603377bf514687ca3 Mon Sep 17 00:00:00 2001 From: angelsl Date: Tue, 22 Jun 2021 21:57:09 +0800 Subject: [PATCH 1/2] Adjust workflow to deploy to CloudFlare Pages --- .github/workflows/build-development.yml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-development.yml b/.github/workflows/build-development.yml index 482b8b146c..f91a9f3ee4 100644 --- a/.github/workflows/build-development.yml +++ b/.github/workflows/build-development.yml @@ -50,28 +50,13 @@ jobs: REACT_APP_ENVIRONMENT: "pages" REACT_APP_MODULE_BACKEND_URL: https://source-academy.github.io/modules REACT_APP_SHAREDB_BACKEND_URL: ${{ secrets.REACT_APP_SHAREDB_BACKEND_URL }} - REACT_APP_SW_EXCLUDE_REGEXES: '["^/source", "^/sicp", "^/modules", "^/ev3-source"]' - PUBLIC_URL: "https://source-academy.github.io" + PUBLIC_URL: "https://sourceacademy.org" REACT_APP_GITHUB_OAUTH_PROXY_URL: ${{ secrets.REACT_APP_GITHUB_OAUTH_PROXY_URL }} REACT_APP_GITHUB_CLIENT_ID: ${{ secrets.REACT_APP_GITHUB_CLIENT_ID }} - - name: Create symbolic links - run: | - set -euxo pipefail - ln -s index.html build/playground.html - ln -s index.html build/contributors.html - ln -s index.html build/sourcecast.html - ln -s index.html build/interactive-sicp.html - mkdir -p build/interactive-sicp - declare -a arr=("index" "foreword" "prefaces03" "prefaces84" "prefaces96" "acknowledgements" "1" "1.1" "1.1.1" "1.1.2" "1.1.3" "1.1.4" "1.1.5" "1.1.6" "1.1.7" "1.1.8" "1.2" "1.2.1" "1.2.2" "1.2.3" "1.2.4" "1.2.5" "1.2.6" "1.3" "1.3.1" "1.3.2" "1.3.3" "1.3.4" "2" "2.1" "2.1.1" "2.1.2" "2.1.3" "2.1.4" "2.2" "2.2.1" "2.2.2" "2.2.3" "2.2.4" "2.3" "2.3.1" "2.3.2" "2.3.3" "2.3.4" "2.4" "2.4.1" "2.4.2" "2.4.3" "2.5" "2.5.1" "2.5.2" "2.5.3" "3" "3.1" "3.1.1" "3.1.2" "3.1.3" "3.2" "3.2.1" "3.2.2" "3.2.3" "3.2.4" "3.3" "3.3.1" "3.3.2" "3.3.3" "3.3.4" "3.3.5" "3.4" "3.4.1" "3.4.2" "3.5" "3.5.1" "3.5.2" "3.5.3" "3.5.4" "3.5.5" "4" "4.1" "4.1.1" "4.1.2" "4.1.3" "4.1.4" "4.1.5" "4.1.6" "4.1.7" "4.2" "4.2.1" "4.2.2" "4.2.3" "4.3" "4.3.1" "4.3.2" "4.3.3" "4.4" "4.4.1" "4.4.2" "4.4.3" "4.4.4" "5" "5.1" "5.1.1" "5.1.2" "5.1.3" "5.1.4" "5.1.5" "5.2" "5.2.1" "5.2.2" "5.2.3" "5.2.4" "5.3" "5.3.1" "5.3.2" "5.4" "5.4.1" "5.4.2" "5.4.3" "5.4.4" "5.5" "5.5.1" "5.5.2" "5.5.3" "5.5.4" "5.5.5" "5.5.6" "5.5.7" "references" "making-of") - for i in "${arr[@]}"; do - ln -s ../index.html build/interactive-sicp/$i.html - done - # the `ln`s above are a hack to make GitHub Pages route /playground - # and /contributors etc to index, instead of 404-ing. - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - external_repository: source-academy/source-academy.github.io + external_repository: source-academy/sourceacademy.org deploy_key: ${{ secrets.DEPLOY_PRIVATE_KEY }} publish_dir: ./build publish_branch: master From 761ed2ca47d1c5fa9bd8fa8cd5b183038e7cb032 Mon Sep 17 00:00:00 2001 From: angelsl Date: Tue, 22 Jun 2021 22:37:19 +0800 Subject: [PATCH 2/2] Upload sourcemaps to Sentry --- .github/workflows/build-development.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-development.yml b/.github/workflows/build-development.yml index f91a9f3ee4..00c5e055d6 100644 --- a/.github/workflows/build-development.yml +++ b/.github/workflows/build-development.yml @@ -1,4 +1,4 @@ -name: Build source-academy.github.io +name: Build sourceacademy.org on: push: branches: @@ -14,6 +14,9 @@ jobs: uses: actions/setup-node@v2-beta with: node-version: '14' + - name: Setup Sentry CLI + run: | + curl -sL https://sentry.io/get-cli/ | INSTALL_DIR=. bash - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" @@ -53,6 +56,24 @@ jobs: PUBLIC_URL: "https://sourceacademy.org" REACT_APP_GITHUB_OAUTH_PROXY_URL: ${{ secrets.REACT_APP_GITHUB_OAUTH_PROXY_URL }} REACT_APP_GITHUB_CLIENT_ID: ${{ secrets.REACT_APP_GITHUB_CLIENT_ID }} + - name: Create Sentry release + working-directory: build + run: | + SENTRY_RELEASE="cadet-frontend@$REACT_APP_VERSION" + "$GITHUB_WORKSPACE/sentry-cli" releases new -p "$SENTRY_PROJECT" "$SENTRY_RELEASE" + "$GITHUB_WORKSPACE/sentry-cli" releases set-commits --auto "$SENTRY_RELEASE" + "$GITHUB_WORKSPACE/sentry-cli" releases files "$SENTRY_RELEASE" upload-sourcemaps --url-prefix '~/static/js' --rewrite static/js + "$GITHUB_WORKSPACE/sentry-cli" releases finalize "$SENTRY_RELEASE" + "$GITHUB_WORKSPACE/sentry-cli" releases deploys "$SENTRY_RELEASE" new -e pages + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_ORG: sourceacademy + SENTRY_PROJECT: cadet-frontend + REACT_APP_VERSION: ${{ format('{0}-{1}', github.sha, steps.get-time.outputs.time) }} + - name: Remove sourcemaps + working-directory: build + run: | + find -name '*.map' -print -delete - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: