From b85b7b5404c9f5f9468d0b1468598527523fa292 Mon Sep 17 00:00:00 2001 From: Mark Waddle Date: Mon, 30 Sep 2024 23:12:10 +0000 Subject: [PATCH 1/2] Replace VITE_* env vars at build time --- .github/workflows/workbench-app.yml | 41 +++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workbench-app.yml b/.github/workflows/workbench-app.yml index d2f105ee..ae6ae6c4 100644 --- a/.github/workflows/workbench-app.yml +++ b/.github/workflows/workbench-app.yml @@ -19,7 +19,7 @@ on: workflow_dispatch: jobs: - build: + build-pr: runs-on: ubuntu-latest steps: @@ -51,10 +51,47 @@ jobs: name: semantic-workbench-node-app path: ./workbench-app/build/semantic-workbench-release.zip + build-main: + runs-on: ubuntu-latest + if: github.event_name != 'pull_request' + environment: + name: production + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js version + uses: actions/setup-node@v4 + with: + node-version: "20.x" + + - name: npm install, build, and test + run: | + npm install + npm run build --if-present + npm run test --if-present + working-directory: ./workbench-app + env: + NODE_OPTIONS: "--max_old_space_size=8192" + VITE_SEMANTIC_WORKBENCH_AUTHORITY: ${{ secrets.VITE_SEMANTIC_WORKBENCH_AUTHORITY }} + VITE_SEMANTIC_WORKBENCH_CLIENT_ID: ${{ secrets.VITE_SEMANTIC_WORKBENCH_CLIENT_ID }} + + - name: Zip artifact for deployment + if: github.event_name != 'pull_request' + run: zip semantic-workbench-release.zip . -r + working-directory: ./workbench-app/build + + - name: Upload artifact for deployment job + if: github.event_name != 'pull_request' + uses: actions/upload-artifact@v4 + with: + name: semantic-workbench-node-app + path: ./workbench-app/build/semantic-workbench-release.zip + deploy: runs-on: ubuntu-latest if: github.event_name != 'pull_request' - needs: build + needs: build-main environment: name: production permissions: From 86637106d2aac19fdb1e6c15a3fa75a4694a1123 Mon Sep 17 00:00:00 2001 From: Mark Waddle Date: Mon, 30 Sep 2024 23:13:55 +0000 Subject: [PATCH 2/2] Don't store artifact for PRs --- .github/workflows/workbench-app.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/workbench-app.yml b/.github/workflows/workbench-app.yml index ae6ae6c4..168e1ac5 100644 --- a/.github/workflows/workbench-app.yml +++ b/.github/workflows/workbench-app.yml @@ -39,18 +39,6 @@ jobs: env: NODE_OPTIONS: "--max_old_space_size=8192" - - name: Zip artifact for deployment - if: github.event_name != 'pull_request' - run: zip semantic-workbench-release.zip . -r - working-directory: ./workbench-app/build - - - name: Upload artifact for deployment job - if: github.event_name != 'pull_request' - uses: actions/upload-artifact@v4 - with: - name: semantic-workbench-node-app - path: ./workbench-app/build/semantic-workbench-release.zip - build-main: runs-on: ubuntu-latest if: github.event_name != 'pull_request'