Skip to content

Commit e7a1109

Browse files
author
ook37
committed
add action
1 parent 1ec3758 commit e7a1109

File tree

2 files changed

+71
-4
lines changed

2 files changed

+71
-4
lines changed

.github/workflows/site-build.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Rebuild and Push Site Changes
2+
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
7+
on:
8+
workflow_dispatch:
9+
push:
10+
branches:
11+
- main
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: checkout
19+
uses: actions/checkout@v4
20+
with:
21+
ref: main
22+
23+
- name: Set up SSH key
24+
run: |
25+
mkdir -p ~/.ssh
26+
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_ed25519
27+
chmod 600 ~/.ssh/id_ed25519
28+
ssh-keyscan -H "${{ secrets.SSH_IP }}" >> ~/.ssh/known_hosts
29+
30+
- name: Install pnpm
31+
uses: pnpm/action-setup@v4
32+
with:
33+
version: 10
34+
35+
- name: Setup Node.js
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: 20
39+
cache: 'pnpm'
40+
41+
- name: Install deps
42+
run: pnpm install
43+
44+
- name: Build
45+
run: pnpm run build
46+
47+
- name: Upload static files
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: site-build
51+
path: out/
52+
53+
- name: Upload to server
54+
run: |
55+
SSH_LOCATION="${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}"
56+
if [ -n "${{ secrets.SSH_DIR }}" ]; then
57+
ssh -i ~/.ssh/id_ed25519 "${SSH_LOCATION}" "rm -rf ${{ secrets.SSH_DIR }}/*"
58+
scp -i ~/.ssh/id_ed25519 -rp out/* "${SSH_LOCATION}:${{ secrets.SSH_DIR }}"
59+
else
60+
echo "Error: SSH_DIR not set"
61+
exit 1
62+
fi

next.config.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
const withNextra = require('nextra')({
22
theme: 'nextra-theme-blog',
3-
themeConfig: './theme.config.jsx'
4-
})
5-
6-
module.exports = withNextra()
3+
themeConfig: './theme.config.jsx',
4+
});
5+
6+
module.exports = withNextra({
7+
output: 'export',
8+
images: {
9+
unoptimized: true,
10+
},
11+
});

0 commit comments

Comments
 (0)