Skip to content

Update main.yml

Update main.yml #11

Workflow file for this run

name: Deploy static content to Pages
on:
push:
branches: ['main']
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: "./site/package-lock.json"
- 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: Install dependencies
run: npm ci --prefix site
- name: List node_modules after dependency installation
run: ls -al site/node_modules
- name: Build
run: npm run build --prefix site
- 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
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'site/dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4