-
Notifications
You must be signed in to change notification settings - Fork 27
43 lines (38 loc) · 1.27 KB
/
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
name: deploy
on:
push:
branches:
- main
paths:
- nginx.conf
- 'MaaAssistantArknights/**'
- .github/workflows/deploy.yml
workflow_dispatch:
jobs:
sync-repo:
runs-on: ubuntu-latest
steps:
- name: Setup ssh key
env:
SSH_PRIVATE_KEY: ${{ secrets.OTA_SERVER_SSH_KEY }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" >> ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -t rsa -H ${{ secrets.OTA_SERVER_SSH_HOST }} >> ~/.ssh/known_hosts
- name: Sync repository
run: |
ssh ${{ secrets.OTA_SERVER_SSH_USER }}@${{ secrets.OTA_SERVER_SSH_HOST }} \
"
set -e
mkdir -p ~/MaaRelease
cd ~/MaaRelease
git init
git fetch --force --no-tags --prune --update-head-ok --progress \
'https://github.com/${{ github.repository }}' \
'+HEAD:refs/remotes/origin/HEAD'
git checkout --force --progress refs/remotes/origin/HEAD
echo Generating lastUpdateTime.json
mkdir -p MaaAssistantArknights/api/
date --utc +%Y%m%d%H%M%S | jq '{timestamp:.}' | tee MaaAssistantArknights/api/lastUpdateTime.json
"