feat: add deploy to CI
This commit is contained in:
43
.github/workflows/deploy.yml
vendored
Normal file
43
.github/workflows/deploy.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
name: 🚀 Deploy Static Content to GitHub Pages
|
||||
|
||||
on: push
|
||||
|
||||
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: read # Read access to repository contents
|
||||
pages: write # Write access for deployment to GitHub Pages
|
||||
id-token: write # Allow GitHub to issue an ID token for authentication
|
||||
|
||||
# Allow only one concurrent deployment at a time
|
||||
concurrency:
|
||||
group: pages # Group deployments by name for concurrency control
|
||||
cancel-in-progress: true # Cancel any in-progress deployments if a new one starts
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: 🚀 Deploy to GitHub Pages
|
||||
if: github.ref == 'refs/heads/master' # Only deploy from the main branch
|
||||
environment:
|
||||
name: github-pages # Set deployment environment to GitHub Pages
|
||||
url: ${{ steps.deployment.outputs.page_url }} # Output page URL
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository 📥
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Node.js v20 💻
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Install Dependencies 🛠️
|
||||
run: npm ci
|
||||
- name: Build Static Content 🏗️
|
||||
run: NODE_ENV=production npm run build
|
||||
- name: Setup GitHub Pages ⚙️
|
||||
uses: actions/configure-pages@v4
|
||||
- name: Upload Build Artifacts 📦
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: ./build # Path to the build output directory
|
||||
- name: Deploy to GitHub Pages 🌐
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4 # Deploy the build to GitHub Pages
|
||||
Reference in New Issue
Block a user