-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (38 loc) · 1.22 KB
/
deploy.yml
File metadata and controls
45 lines (38 loc) · 1.22 KB
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
name: Build & Deploy VitePress Site
# Trigger the workflow on push to the dev branch
on:
push:
branches:
- dev
# Add permissions to allow GitHub token to push to the repository
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source code from dev branch
uses: actions/checkout@v3
with:
ref: dev
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm ci
- name: Build VitePress site
run: npm run docs:build
# Ensure your package.json has a script like:
# "docs:build": "vitepress build docs"
- name: Deploy built site to main branch
working-directory: docs/.vitepress/dist
run: |
git init
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Deploy VitePress site"
git branch -M main
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git push -f origin main