47 lines
1.0 KiB
YAML
47 lines
1.0 KiB
YAML
name: Test, Build, and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: 📥 Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 🟢 Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: ♻️ Cache npm
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node-
|
|
|
|
- name: 📦 Install dependencies
|
|
run: npm ci
|
|
|
|
- name: 🧪 Run tests
|
|
run: npm run test
|
|
|
|
- name: 🛠️ Build project
|
|
run: npm run build
|
|
|
|
- name: 🛑 Disable Jekyll
|
|
run: echo > dist/.nojekyll
|
|
|
|
- name: 🚀 Deploy
|
|
if: success() && github.ref == 'refs/heads/master'
|
|
uses: peaceiris/actions-gh-pages@v4
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
publish_dir: ./dist
|