Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build of WB dashboard with env vars #233

Merged
3 commits merged into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .github/workflows/build_prod_wb-dashboard.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Build prod WB dashboard

on:
pull_request:
branches:
- "main"
- "staging"
paths:
- '.github/workflows/build_prod_wb-dashboard.yml'
- 'webapps/world-builder-dashboard/**'
pull_request:
branches:
- "main"
- "staging"
paths:
- ".github/workflows/build_prod_wb-dashboard.yml"
- "webapps/world-builder-dashboard/**"

jobs:
build_prod_wb-dashboard:
Expand All @@ -24,6 +24,9 @@ jobs:

- name: Build frontend
working-directory: ./webapps/world-builder-dashboard
env:
VITE_NB_JSON_RPC_URI: ${{ secrets.VITE_NB_JSON_RPC_URI }}
VITE_NB_WB_DASHBOARD_ACCESS_ID: ${{ secrets.VITE_NB_WB_DASHBOARD_ACCESS_ID }}
run: |
npm install
npm run build
npm run build
22 changes: 13 additions & 9 deletions .github/workflows/deploy_manual_branch_wb-dashboard.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Manual Deploy branch WB dashboard

on:
workflow_dispatch: # Allow manual trigger
inputs:
branch:
description: "Branch to deploy"
required: true
default: "staging"
workflow_dispatch: # Allow manual trigger
inputs:
branch:
description: "Branch to deploy"
required: true
default: "staging"

jobs:
deploy_manual_branch_wb-dashboard:
Expand All @@ -15,7 +15,7 @@ jobs:
steps:
- name: Show branch name
run: |
echo "Running manual deployment for ${{ github.event.inputs.branch || github.event.pull_request.head.ref }} branch"
echo "Running manual deployment for ${{ github.event.inputs.branch || github.event.pull_request.head.ref }} branch"

- name: Checkout repository and main branch
uses: actions/checkout@v2
Expand All @@ -29,14 +29,18 @@ jobs:

- name: Install and build staging app
working-directory: ./webapps/world-builder-dashboard
env:
VITE_NB_JSON_RPC_URI: ${{ secrets.VITE_NB_JSON_RPC_URI }}
VITE_NB_WB_DASHBOARD_ACCESS_ID: ${{ secrets.VITE_NB_WB_DASHBOARD_ACCESS_ID }}
VITE_BUILD_TARGET: ${{ github.event.inputs.branch || github.event.pull_request.head.ref }}
run: |
npm install
npm run build

- name: Update robots.txt, block alpha for crawlers
working-directory: ./webapps/world-builder-dashboard/dist
run: |
sed -i "s/Disallow:.*/Disallow: \//" robots.txt
sed -i "s/Disallow:.*/Disallow: \//" robots.txt

- name: Upload static site to S3 bucket and invalidate CloudFront cache
working-directory: ./webapps/world-builder-dashboard
Expand Down
23 changes: 13 additions & 10 deletions .github/workflows/deploy_prod_wb-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Deploy prod WB dashboard

on:
push:
branches:
- main
paths:
- '.github/workflows/deploy_prod_wb-dashboard.yml'
- 'webapps/world-builder-dashboard/**'
branches:
- main
paths:
- ".github/workflows/deploy_prod_wb-dashboard.yml"
- "webapps/world-builder-dashboard/**"

jobs:
deploy_prod_wb-dashboard:
Expand All @@ -25,15 +25,18 @@ jobs:

- name: Install and build production app
working-directory: ./webapps/world-builder-dashboard
env:
VITE_NB_JSON_RPC_URI: ${{ secrets.VITE_NB_JSON_RPC_URI }}
VITE_NB_WB_DASHBOARD_ACCESS_ID: ${{ secrets.VITE_NB_WB_DASHBOARD_ACCESS_ID }}
run: |
npm install
npm run build

- name: Publish to CloudFlare Page
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CF_API_TOKEN_PROD }}
accountId: ${{ secrets.CF_ACCOUNT_ID_PROD }}
projectName: ${{ secrets.CF_PROJECT_NAME_WB_DASHBOARD_PROD }}
directory: ./webapps/world-builder-dashboard/dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
apiToken: ${{ secrets.CF_API_TOKEN_PROD }}
accountId: ${{ secrets.CF_ACCOUNT_ID_PROD }}
projectName: ${{ secrets.CF_PROJECT_NAME_WB_DASHBOARD_PROD }}
directory: ./webapps/world-builder-dashboard/dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
28 changes: 16 additions & 12 deletions .github/workflows/deploy_staging_wb-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Deploy staging WB dashboard

on:
push:
branches:
- staging
paths:
- '.github/workflows/deploy_staging_wb-dashboard.yml'
- 'webapps/world-builder-dashboard/**'
branches:
- staging
paths:
- ".github/workflows/deploy_staging_wb-dashboard.yml"
- "webapps/world-builder-dashboard/**"

jobs:
deploy_staging_wb-dashboard:
Expand All @@ -25,20 +25,24 @@ jobs:

- name: Install and build staging app
working-directory: ./webapps/world-builder-dashboard
env:
VITE_NB_JSON_RPC_URI: ${{ secrets.VITE_NB_JSON_RPC_URI }}
VITE_NB_WB_DASHBOARD_ACCESS_ID: ${{ secrets.VITE_NB_WB_DASHBOARD_ACCESS_ID }}
VITE_BUILD_TARGET: staging
run: |
npm install
npm run build

- name: Update robots.txt, block alpha for crawlers
working-directory: ./webapps/world-builder-dashboard/dist
run: |
sed -i "s/Disallow:.*/Disallow: \//" robots.txt
sed -i "s/Disallow:.*/Disallow: \//" robots.txt

- name: Publish to CloudFlare Page
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CF_API_TOKEN_STAGE }}
accountId: ${{ secrets.CF_ACCOUNT_ID_STAGE }}
projectName: ${{ secrets.CF_PROJECT_NAME_WB_DASHBOARD_STAGE }}
directory: ./webapps/world-builder-dashboard/dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
apiToken: ${{ secrets.CF_API_TOKEN_STAGE }}
accountId: ${{ secrets.CF_ACCOUNT_ID_STAGE }}
projectName: ${{ secrets.CF_PROJECT_NAME_WB_DASHBOARD_STAGE }}
directory: ./webapps/world-builder-dashboard/dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
Loading