Skip to content

Commit

Permalink
Vite env var
Browse files Browse the repository at this point in the history
  • Loading branch information
kompotkot committed Dec 6, 2024
1 parent 22e0c8e commit f9b5773
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 49 deletions.
20 changes: 10 additions & 10 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 @@ -25,8 +25,8 @@ jobs:
- name: Build frontend
working-directory: ./webapps/world-builder-dashboard
env:
NEXT_PUBLIC_NB_JSON_RPC_URI: ${{ secrets.NEXT_PUBLIC_NB_JSON_RPC_URI }}
NEXT_PUBLIC_NB_WB_DASHBOARD_ACCESS_ID: ${{ secrets.NEXT_PUBLIC_NB_WB_DASHBOARD_ACCESS_ID }}
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
24 changes: 12 additions & 12 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 @@ -30,17 +30,17 @@ jobs:
- name: Install and build staging app
working-directory: ./webapps/world-builder-dashboard
env:
NEXT_PUBLIC_NB_JSON_RPC_URI: ${{ secrets.NEXT_PUBLIC_NB_JSON_RPC_URI }}
NEXT_PUBLIC_NB_WB_DASHBOARD_ACCESS_ID: ${{ secrets.NEXT_PUBLIC_NB_WB_DASHBOARD_ACCESS_ID }}
NEXT_PUBLIC_BUILD_TARGET: ${{ github.event.inputs.branch || github.event.pull_request.head.ref }}
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
24 changes: 12 additions & 12 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 @@ -26,17 +26,17 @@ jobs:
- name: Install and build production app
working-directory: ./webapps/world-builder-dashboard
env:
NEXT_PUBLIC_NB_JSON_RPC_URI: ${{ secrets.NEXT_PUBLIC_NB_JSON_RPC_URI }}
NEXT_PUBLIC_NB_WB_DASHBOARD_ACCESS_ID: ${{ secrets.NEXT_PUBLIC_NB_WB_DASHBOARD_ACCESS_ID }}
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 }}
30 changes: 15 additions & 15 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 @@ -26,23 +26,23 @@ jobs:
- name: Install and build staging app
working-directory: ./webapps/world-builder-dashboard
env:
NEXT_PUBLIC_NB_JSON_RPC_URI: ${{ secrets.NEXT_PUBLIC_NB_JSON_RPC_URI }}
NEXT_PUBLIC_NB_WB_DASHBOARD_ACCESS_ID: ${{ secrets.NEXT_PUBLIC_NB_WB_DASHBOARD_ACCESS_ID }}
NEXT_PUBLIC_BUILD_TARGET: staging
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 }}

0 comments on commit f9b5773

Please sign in to comment.