Skip to content

Add workflow to publish github page #1

Add workflow to publish github page

Add workflow to publish github page #1

Workflow file for this run

name: gh-pages
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
timeout-minutes: 2
- uses: actions/setup-node@v4
with:
cache: npm
node-version: 'lts/*'
- name: Install Dependencies
run: npm install
timeout-minutes: 2
- name: Build
run: npm run build -- --base /${{ github.event.repository.name }}/
timeout-minutes: 2
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist/
timeout-minutes: 2
deploy:
needs: build
runs-on: ubuntu-latest
if: >-
(github.event_name == 'push' && github.ref == 'refs/heads/main')
|| github.event_name == 'workflow_dispatch'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
- uses: actions/configure-pages@v4
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
timeout-minutes: 2