-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add scripts for building backend and frontend
- Loading branch information
1 parent
38193a8
commit 151f44c
Showing
4 changed files
with
45 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Deploy pages | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js 18.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
cache: 'npm' | ||
- run: yarn install | ||
- name: Build | ||
run: | | ||
cd packages/serverless-backend | ||
npx @cloudflare/next-on-pages@1 | ||
- name: Deploy | ||
env: | ||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | ||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
run: | | ||
cd packages/serverless-backend | ||
npx wrangler pages deploy .vercel/output/static --branch=$BRANCH_NAME --project-name=unirep-explorer-backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
# Load environment variables from .env file | ||
source .env | ||
|
||
if [ "$CF_PAGES_BRANCH" = "production" ]; then | ||
echo "export const version = 'v2.0.0'" > packages/frontend/src/config.js | ||
echo "export const network = 'sepolia'" >> packages/frontend/src/config.js | ||
echo "export const SERVER = 'https://unirep-explorer-backend.pages.dev'" >> packages/frontend/src/config.js | ||
elif [ "$CF_PAGES_BRANCH" = "staging" ]; then | ||
branch=$(git branch --show-current) | ||
branch="${branch%"${branch##*[![:space:]]}"}" # Trim trailing whitespace | ||
echo "export const version = 'v2.0.0'" > packages/frontend/src/config.js | ||
echo "export const network = 'sepolia'" >> packages/frontend/src/config.js | ||
echo "export const SERVER = 'https://${branch}.unirep-explorer-backend.pages.dev'" >> packages/frontend/src/config.js | ||
fi |
This file was deleted.
Oops, something went wrong.