Skip to content

Commit 8a5dfcd

Browse files
author
Ben Roe
committed
build: push files to dist branch
1 parent 96bc0d5 commit 8a5dfcd

1 file changed

Lines changed: 21 additions & 61 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 21 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,36 @@
1-
name: 🚀 Deploy vitepress to help.keycapsss.com
1+
name: 🚀 Build and deploy vitepress
2+
23
on:
3-
workflow_dispatch:
44
push:
55
branches:
6-
- master # Triggers the action on push to the 'main' branch
7-
# tags:
8-
# - v*.*.* # Triggers the action on tag
6+
- main
7+
workflow_dispatch: # Allows manual trigger
98

109
jobs:
11-
build:
12-
name: 🚧 Build
10+
build-and-deploy:
1311
runs-on: ubuntu-latest
1412
steps:
15-
- name: Get latest code
16-
uses: actions/checkout@v4
13+
- name: Checkout
14+
uses: actions/checkout@v5
1715
with:
18-
fetch-depth: 0
16+
fetch-depth: 0 # Not needed if lastUpdated is not enabled
1917

20-
- name: Setup Node.js
21-
uses: actions/setup-node@v4
18+
- name: Setup Node
19+
uses: actions/setup-node@v6
2220
with:
23-
node-version: "24"
24-
25-
- name: Get tag version
26-
id: get_tag
27-
run: echo "TAG_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
28-
29-
- name: Set environment variables from GitHub Secrets
30-
run: |
31-
echo "FTP_HOST=${{ secrets.FTP_HOST }}" >> $GITHUB_ENV
21+
node-version: 24
22+
cache: npm
3223

3324
- name: Install dependencies
34-
run: npm install
35-
36-
- name: Build Vitepress site
37-
run: npm run docs:build # Assumes there's a build script in package.json
38-
39-
- name: Upload artifacts
40-
uses: actions/upload-artifact@v4
41-
with:
42-
name: vitepress-dist
43-
path: docs/.vitepress/dist/
44-
retention-days: 1
45-
46-
deploy:
47-
name: 🚀 Deploy
48-
needs: build
49-
runs-on: ubuntu-latest
50-
steps:
51-
- name: Download artifacts
52-
uses: actions/download-artifact@v4
53-
with:
54-
name: vitepress-dist
55-
path: dist/
25+
run: npm ci
5626

57-
# - name: Clean target directory
58-
# uses: appleboy/ssh-action@master
59-
# with:
60-
# host: ${{ secrets.SSH_HOST }}
61-
# username: ${{ secrets.SSH_USERNAME }}
62-
# key: ${{ secrets.SSH_PRIVATE_KEY }}
63-
# port: ${{ secrets.SSH_PORT }}
64-
# script: |
65-
# rm -rf /data/coolify/services/pwogokkc8gggwc408s4kkos4/web/help.keycapsss.com/*
27+
- name: Build with VitePress
28+
run: npm run docs:build
6629

67-
- name: Upload files via SCP
68-
uses: appleboy/scp-action@master
30+
- name: Deploy to dist branch
31+
uses: peaceiris/actions-gh-pages@v4
6932
with:
70-
host: ${{ secrets.SSH_HOST }}
71-
username: ${{ secrets.SSH_USERNAME }}
72-
key: ${{ secrets.SSH_PRIVATE_KEY }}
73-
port: ${{ secrets.SSH_PORT }}
74-
source: "dist/*"
75-
target: "/data/coolify/services/pwogokkc8gggwc408s4kkos4/web/help.keycapsss.com"
76-
strip_components: 1
33+
github_token: ${{ secrets.GITHUB_TOKEN }}
34+
publish_dir: ./docs/.vitepress/dist
35+
publish_branch: dist
36+
force_orphan: true # Keeps the dist branch clean without history

0 commit comments

Comments
 (0)