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 a45c154 commit 1cc7c68
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
on: push
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:
Expand All @@ -9,41 +24,38 @@ jobs:
- 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: 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
run: npm ci --prefix site
working-directory: site
run: npm ci

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

# 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:
Expand All @@ -53,3 +65,4 @@ jobs:
id: deployment
uses: actions/deploy-pages@v4


0 comments on commit 1cc7c68

Please sign in to comment.