Skip to content

Merge pull request #22 from matbutom/main #7

Merge pull request #22 from matbutom/main

Merge pull request #22 from matbutom/main #7

name: Deploy Mechanic static site to GitHub Pages
on:
push:
branches:
- main
permissions:
contents: write
pages: write
id-token: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache node modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('faaad/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm install
working-directory: ./faaad
- name: Clean possible lockfiles
run: rm -f mechanic.json.lock
working-directory: ./faaad
- name: Build Mechanic static site
run: npm run build
working-directory: ./faaad
- name: Check if dist exists
run: |
if [ ! -d "./dist" ]; then
echo "ERROR: ./dist was not created by the build."
exit 1
fi
working-directory: ./faaad
- name: List build output
run: ls -la ./dist
working-directory: ./faaad
- name: Add .nojekyll
run: touch ./faaad/dist/.nojekyll
- run: npm install
working-directory: ./faaad
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./faaad/dist