Added npm info #32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish JSDoc documentation in Node.js app in GitHub Pages | |
on: | |
push: | |
branches: | |
- dev | |
pull_request: | |
branches: | |
- dev | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: | |
- 22.x | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/[email protected] | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
- name: Install dependencies | |
run: npm ci | |
- name: Optional build step | |
run: npm run build --if-present | |
- name: Generate JSDoc | |
run: npm run docs | |
- name: Create artifact | |
uses: actions/[email protected] | |
with: | |
name: docs | |
path: ./docs | |
deploy: | |
needs: build | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to gh-pages # Deploy documentation to gh-pages branch | |
uses: actions/[email protected] | |
with: | |
ref: gh-pages | |
repository: ${{ github.repository }} | |
token: ${{ github.token }} | |
- name: Clear existing content (optional) | |
run: rm -rf ./docs # This will remove all existing files in the gh-pages branch | |
- name: Download artifact | |
uses: actions/[email protected] | |
with: | |
name: docs | |
path: ./docs | |
- name: Copy license | |
run: cp LICENSE.txt ./docs/LICENSE.txt | |
- name: Commit and push to gh-pages | |
run: | | |
git config user.name ${{ github.actor }} | |
git config user.email ${{ secrets.ACTOR_EMAIL }} | |
git add . | |
git commit -m "Deploy JSDoc documentation" | |
git push origin gh-pages |