更新文档,添加流密码基本思想的描述 #276
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Hexo Deploy | |
on: | |
push: | |
branches: | |
- main | |
env: | |
TZ: Asia/Shanghai | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
with: | |
ref: main | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "20" | |
- name: Setup Hexo | |
env: | |
ACTION_DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$ACTION_DEPLOY_KEY" | tr -d '\r' > ~/.ssh/id_rsa | |
chmod 700 ~/.ssh | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
git config --global user.email "w1ndys@outlook.com" | |
git config --global user.name "W1ndys" | |
git config --global init.defaultBranch main | |
npm install hexo-cli -g | |
npm install | |
- name: Deploy | |
run: | | |
hexo clean | |
hexo generate | |
hexo deploy | |
- name: ECS clone # 连接服务器并克隆 | |
uses: cross-the-world/ssh-pipeline@master | |
env: | |
WELCOME: "ssh pipeline" | |
with: | |
host: ${{ secrets.USER_HOST }} # 服务器的 IP 地址 | |
user: ${{ secrets.USER_NAME }} # 服务器的用户名 | |
pass: ${{ secrets.USER_PASS }} # 服务器的密码 | |
connect_timeout: 10s | |
script: | | |
echo "进入 ECS_SITE 目录" | |
cd ${{ secrets.ECS_SITE }} | |
rm -rf ${{ secrets.GH_REPO }} | |
git clone --depth 1 -b gh-pages git@github.com:${{ secrets.GH_USERNAME }}/${{ secrets.GH_REPO }}.git | |
rm -rf index | |
mv ${{ secrets.GH_REPO }} index | |
cd index | |
rm -rf .git | |
chown -R 1000:1000 . | |
echo "脚本执行完毕" |