Skip to content

Ntran/dep

Ntran/dep #7

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
node_modules
dist
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run build
env:
GITHUB_PAGES: 'true'
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: github-pages-${{ github.run_id }}
path: dist
retention-days: 1
deploy:
needs: build
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: github-pages-${{ github.run_id }}
path: dist
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: './dist'
- name: Deploy to GitHub Pages
id: deploy
uses: actions/deploy-pages@v4