-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (43 loc) · 1.37 KB
/
build_and_deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Gatsby Build and Deploy to gh-pages branch
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v3
# Set up Node.js for the Gatsby build
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
# Cache dependencies to speed up builds
- name: Cache Node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# Install dependencies and build the Gatsby site
- name: Install dependencies and build site
run: |
npm ci
npm run build
# Deploy the built Gatsby site to GitHub Pages
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: ./public # Gatsby builds the site in the 'public' folder
github_token: ${{ secrets.GITHUB_TOKEN }} # Verwende den PAT Token für das Deployment
force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
commit_message: 'Deploy Gatsby site'