-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (66 loc) · 2.64 KB
/
fetch_build_and_deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Fetch Build and Deploy
on:
workflow_dispatch:
schedule:
- cron: '0 21 * * *'
jobs:
fetch_build_and_deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected] # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
persist-credentials: false
submodules: true
fetch-depth: 0
- name: Pull XCPCIO
run: |
cd XCPCIO
git checkout master
git pull
cd ..
- name: Commit XCPCIO
run: |
git config --local user.email ${{ secrets.USER_EMAIL }}
git config --local user.name ${{ secrets.USER_NAME }}
git add .
git commit -m "fetch XCPCIO"
continue-on-error: true
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Set up Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
run: |
cd XCPCIO
npm install
pip3 install -U -r requirements.txt
sed -i "s|mirror_download_host: \.\/|mirror_download_host: ${{ secrets.MIRROR_DOWNLOAD_HOST }}|" docs/src/mkdocs.yml
sed -i "s|upload_file_host: \.\/|upload_file_host: ${{ secrets.UPLOAD_FILE_HOST }}|" docs/src/mkdocs.yml
sed -i "s|assets_host: \/assets\/|assets_host: ${{ secrets.ASSETS_HOST }}|" docs/src/mkdocs.yml
npm run build
- name: Release
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: XCPCIO/site # The folder the action should deploy.
CLEAN: true # Automatically remove deleted files from the deploy branch
- name: Deploy
uses: appleboy/ssh-action@master # 使用ssh链接服务器
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
${{ secrets.RUN_SCRIPT }}