Skip to content

Instantly share code, notes, and snippets.

@lifeparticle
Created June 26, 2023 02:33
Show Gist options
  • Save lifeparticle/c6b5852c4db843f945d4770d202365b4 to your computer and use it in GitHub Desktop.
Save lifeparticle/c6b5852c4db843f945d4770d202365b4 to your computer and use it in GitHub Desktop.
name: Deploy React Application to Pages
on:
workflow_dispatch:
push:
branches:
- main
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18.4.x
cache: npm
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
env:
CI: true
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "./dist"
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@v2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment