Skip to content

Commit ab13218

Browse files
EmptyDustcodex
andcommitted
revert: undo rainyun workflow migration
Co-authored-by: Codex <codex@openai.com>
1 parent 7a8ebe7 commit ab13218

4 files changed

Lines changed: 17 additions & 216 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 11 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
runs-on: ubuntu-latest
1616
env:
1717
TZ: Asia/Shanghai
18+
permissions:
19+
contents: write
1820
concurrency:
1921
group: ${{ github.workflow }}-${{ github.ref_name }}
2022

@@ -44,83 +46,21 @@ jobs:
4446

4547
- name: 安装项目依赖
4648
run: |
49+
# 这一步会根据新的 package.json 安装所有东西
50+
# 包括:hexo核心、渲染器(pug/stylus)、gulp、bangumi插件
4751
yarn install --immutable
4852
49-
- name: 校验 Rainyun 部署参数
50-
env:
51-
RAINYUN_HOST: ${{ secrets.RAINYUN_HOST }}
52-
RAINYUN_PORT: ${{ secrets.RAINYUN_PORT }}
53-
RAINYUN_USER: ${{ secrets.RAINYUN_USER }}
54-
RAINYUN_TARGET_DIR: ${{ secrets.RAINYUN_TARGET_DIR }}
55-
RAINYUN_SSH_KEY: ${{ secrets.RAINYUN_SSH_KEY }}
56-
run: |
57-
for key in RAINYUN_HOST RAINYUN_USER RAINYUN_TARGET_DIR RAINYUN_SSH_KEY; do
58-
if [ -z "${!key}" ]; then
59-
echo "::error::缺少 GitHub Secret: ${key}"
60-
exit 1
61-
fi
62-
done
63-
64-
if [ -z "${RAINYUN_PORT}" ]; then
65-
echo "RAINYUN_PORT 未配置,使用默认端口 22"
66-
fi
67-
68-
- name: 覆盖站点 URL
69-
env:
70-
SITE_URL: ${{ secrets.SITE_URL }}
71-
SITE_ROOT: ${{ secrets.SITE_ROOT }}
72-
run: |
73-
if [ -z "${SITE_URL}" ] && [ -z "${SITE_ROOT}" ]; then
74-
exit 0
75-
fi
76-
77-
node <<'EOF'
78-
const fs = require('fs');
79-
const path = '_config.yml';
80-
let text = fs.readFileSync(path, 'utf8');
81-
82-
if (process.env.SITE_URL) {
83-
text = text.replace(/^url:\s*.*/m, `url: ${process.env.SITE_URL}`);
84-
}
85-
86-
if (process.env.SITE_ROOT) {
87-
text = text.replace(/^root:\s*.*/m, `root: ${process.env.SITE_ROOT}`);
88-
}
89-
90-
fs.writeFileSync(path, text);
91-
EOF
92-
9353
- name: 生成静态文件
9454
run: |
9555
npx hexo clean
9656
npx hexo bangumi -u
9757
npx hexo generate
58+
# 如果以后需要 gulp,取消注释即可,不需要再安装 gulp-cli
59+
# npx gulp
9860
99-
- name: 加载 SSH 私钥
100-
uses: webfactory/ssh-agent@v0.9.1
61+
- name: Deploy
62+
uses: peaceiris/actions-gh-pages@v4
10163
with:
102-
ssh-private-key: ${{ secrets.RAINYUN_SSH_KEY }}
103-
104-
- name: 写入 known_hosts
105-
env:
106-
RAINYUN_HOST: ${{ secrets.RAINYUN_HOST }}
107-
RAINYUN_PORT: ${{ secrets.RAINYUN_PORT }}
108-
run: |
109-
mkdir -p ~/.ssh
110-
chmod 700 ~/.ssh
111-
ssh-keyscan -p "${RAINYUN_PORT:-22}" -H "${RAINYUN_HOST}" >> ~/.ssh/known_hosts
112-
113-
- name: 部署到 Rainyun
114-
env:
115-
RAINYUN_HOST: ${{ secrets.RAINYUN_HOST }}
116-
RAINYUN_PORT: ${{ secrets.RAINYUN_PORT }}
117-
RAINYUN_USER: ${{ secrets.RAINYUN_USER }}
118-
RAINYUN_TARGET_DIR: ${{ secrets.RAINYUN_TARGET_DIR }}
119-
RAINYUN_POST_DEPLOY: ${{ secrets.RAINYUN_POST_DEPLOY }}
120-
run: |
121-
ssh -p "${RAINYUN_PORT:-22}" "${RAINYUN_USER}@${RAINYUN_HOST}" "mkdir -p '${RAINYUN_TARGET_DIR}'"
122-
rsync -az --delete -e "ssh -p ${RAINYUN_PORT:-22}" ./public/ "${RAINYUN_USER}@${RAINYUN_HOST}:${RAINYUN_TARGET_DIR}/"
123-
124-
if [ -n "${RAINYUN_POST_DEPLOY}" ]; then
125-
ssh -p "${RAINYUN_PORT:-22}" "${RAINYUN_USER}@${RAINYUN_HOST}" "${RAINYUN_POST_DEPLOY}"
126-
fi
64+
github_token: ${{ secrets.GITHUB_TOKEN }}
65+
publish_dir: ./public
66+
publish_branch: gh-pages

README.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Fengling's free website.
55

66
- `master`: site code, Hexo config, themes, and deployment workflow
77
- `content`: authored Markdown and content data only
8-
- GitHub Actions: builds from `master + content` and syncs the generated `public/` directory to Rainyun over SSH
8+
- `gh-pages`: generated static files published by GitHub Actions
99

1010
Content paths are defined in `tools/content-paths.txt`.
1111

@@ -32,19 +32,4 @@ GitHub Actions now builds the site from:
3232
- the latest `master` branch for code and build configuration
3333
- the latest `content` branch for posts and page content
3434

35-
The deploy workflow runs on pushes to `master` or `content`, imports `origin/content` into the checked-out `master` tree, builds the site, and syncs `public/` to Rainyun with `rsync`.
36-
37-
## Rainyun Setup
38-
39-
Configure these GitHub Secrets before enabling deployment:
40-
41-
- `RAINYUN_HOST`: Rainyun server IP or domain
42-
- `RAINYUN_PORT`: SSH port, usually `22`
43-
- `RAINYUN_USER`: deploy user, for example `root`
44-
- `RAINYUN_TARGET_DIR`: static site root on the server, for example `/var/www/emptydust`
45-
- `RAINYUN_SSH_KEY`: private key used by GitHub Actions to log into the server
46-
- `RAINYUN_POST_DEPLOY`: optional remote command after upload, for example `sudo systemctl reload nginx`
47-
- `SITE_URL`: optional production site URL used during Hexo build
48-
- `SITE_ROOT`: optional Hexo root, default `/`
49-
50-
See [docs/rainyun-deploy.md](docs/rainyun-deploy.md) for the server-side checklist and an example Nginx config.
35+
The deploy workflow runs on pushes to `master` or `content`, imports `origin/content` into the checked-out `master` tree, builds the site, and publishes to `gh-pages`.

_config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,11 @@ ignore:
111111
theme: anzhiyu
112112

113113
# Deployment
114-
## Production deployment is handled by GitHub Actions and synced to Rainyun via SSH/rsync.
114+
## Docs: https://hexo.io/docs/one-command-deployment
115115
deploy:
116+
type: git
117+
repo: git@github.com:EmptyDust/EmptyDust.github.io.git
118+
branch: gh-pages
116119

117120
pandoc:
118121
args:

docs/rainyun-deploy.md

Lines changed: 0 additions & 127 deletions
This file was deleted.

0 commit comments

Comments
 (0)