Skip to content

Commit

Permalink
update workflow to do the deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam-Mucyo committed Feb 27, 2025
1 parent 8233eae commit 7e21f60
Showing 1 changed file with 38 additions and 9 deletions.
47 changes: 38 additions & 9 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
# This workflow will build and deploy a Node.js project to GitHub Pages

name: Node.js CI
name: Node.js CI and GitHub Pages Deploy

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN 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:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [18.x]

steps:
- uses: actions/checkout@v4
Expand All @@ -25,5 +34,25 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm run build --if-present
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build --if-present
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "./build"

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 7e21f60

Please sign in to comment.