Skip to content

Update main.yml

Update main.yml #6

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'
- name: Verify lock file
working-directory: site
run: |
if [ ! -f package-lock.json ] && [ ! -f npm-shrinkwrap.json ] && [ ! -f 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
working-directory: site
run: npm ci
- name: Build
working-directory: site
run: npm run build
- 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