Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhilekhgautam authored Jun 16, 2024
1 parent af6f383 commit 39755cc
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,4 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ['main']

# 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

# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
Expand All @@ -30,22 +7,48 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

# Adjust the path to the subdirectory where lock files are located
- name: Verify lock file
run: |
if [ ! -f site/package-lock.json ] && [ ! -f site/npm-shrinkwrap.json ] && [ ! -f site/yarn.lock ]; then
echo "No lock file found in 'site' directory. Please ensure you have a lock file (package-lock.json, npm-shrinkwrap.json, or yarn.lock) committed to the 'site' directory."
exit 1
fi
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

# Adjust path to install dependencies in the 'site' directory
- name: Install dependencies
run: npm ci --prefix site

# Adjust path to build the project in the 'site' directory
- name: Build
run: npm run build
run: npm run build --prefix site

# Adjust path to verify the build output in the 'site' directory
- name: Verify build output
run: |
if [ ! -d site/dist ]; then
echo "Build directory 'site/dist' does not exist. Please check your build script."
exit 1
fi
# Adjust path to set up GitHub Pages in the 'site' directory
- name: Setup Pages
uses: actions/configure-pages@v4

# Adjust path to upload the build output from 'site/dist'
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload dist folder
path: './dist'
path: 'site/dist'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 39755cc

Please sign in to comment.