github pages #30
This file contains hidden or 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: github pages | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 20 * * *' | |
discussion: | |
types: [created, edited, answered, deleted, transferred] | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: "Log level" | |
required: true | |
default: "warning" | |
tags: | |
description: "Test scenario tags" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '14' | |
cache: "yarn" | |
cache-dependency-path: "yarn.lock" | |
- run: yarn | |
- run: yarn posts:ci --token=${{ secrets.GITHUB_TOKEN }} --repository=${{ github.repository }} --type=${{ secrets.GG_TYPE }} --dis-owner=${{ secrets.GG_DIS_OWNER }} --dis-repo=${{ secrets.GG_DIS_REPO }} --issues-owner=${{ secrets.GG_ISSUES_OWNER }} --issues-repo=${{ secrets.GG_ISSUES_REPO }} --issues-state=${{ secrets.GG_ISSUES_STATE }} | |
- run: yarn reconf | |
- run: yarn build | |
- run: yarn copy | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
force_orphan: true | |
# 利用action把build好的文件上传到服务器/home/eryajf.github.io路径下,需要确认此目录已在服务端创建 | |
- name: deploy file to server | |
uses: wlixcc/[email protected] | |
with: | |
username: 'root' #ssh user name | |
port: '2023' # 远程服务器ssh端口,默认22 | |
server: '120.26.168.217' # 远程服务器IP | |
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} # 认证服务器秘钥对的私钥 | |
local_path: 'public/*' # 对应我们项目打包后的静态文件路径 | |
remote_path: '/data/www/awesome-ops.opsre.top' # 服务器上的路径 |