React (SPA) #7
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: React (SPA) | |
on: | |
# Runs on pushes targeting the default branch that's only related to the front-end folder. | |
push: | |
branches: ["master"] | |
paths: | |
- "Node+Socket.io+React/front-end/**" | |
# Allows you to run this workflow manually from the Actions tab. | |
workflow_dispatch: | |
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages. | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allows only one deployment at a time. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
# defaults: | |
# run: | |
# working-directory: ./Node+Socket.io+React/front-end | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: "npm" | |
- name: Build App | |
run: | | |
npm ci --workspace front-end | |
npm run build --workspace front-end | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: List Front-end Directory | |
run: ls | |
- name: Upload Artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: "Node+Socket.io+React/front-end/build" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |