chore: Change Prettier config format #35
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 React Application | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# Lint job | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] # We will deploy with only one version of node | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Run lint | |
run: npm run lint | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
needs: lint | |
environment: github-pages | |
strategy: | |
matrix: | |
node-version: [20.x] # We will deploy with only one version of node | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Build React App | |
run: npm run build -- --base=${{ vars.VITE_BASE }} | |
- name: Upload React App build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: react-sierpinski-triangle | |
path: ./build | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
needs: build | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Download React App build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: react-sierpinski-triangle | |
path: ./build | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "./build" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |