Default API base url to proxy server and populate x-api-key header on… #6
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
name: Deploy to GitHubPages | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "npm" | |
- name: Install dependencies | |
run: npm ci | |
- name: "Create .env file" | |
run: | | |
touch .env | |
echo REACT_APP_CAT_API_BASE_URL=${{ vars.REACT_APP_CAT_API_BASE_URL }} >> .env | |
echo REACT_APP_CAT_API_KEY=${{ vars.REACT_APP_CAT_API_KEY }} >> .env | |
- name: Build | |
run: npm run build | |
# serve the app's custom 404 page instead of Pages' | |
- name: Copy index.html to 404.html | |
run: cp "./build/index.html" "./build/404.html" | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "./build" | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |