-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (130 loc) · 4.62 KB
/
regen-all.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Regenerate All config
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
schedule:
- cron: '0 0 * * *'
concurrency:
group: "PoemaIX-BIRDGen"
cancel-in-progress: true
jobs:
repo-sync:
name: Regenerate All config
runs-on: ubuntu-latest
timeout-minutes: 10
env:
GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa"
steps:
- name: Checkout Central Actions Repo
uses: actions/checkout@v3
- name: symlink to /root/arouteserver
run: |
sudo chmod 777 /root
ln -s $GITHUB_WORKSPACE /root/arouteserver
- name: setup ssh key
run: |
sudo chmod 777 /root
mkdir -p /root/.ssh
sudo chown -R "$USER" /root/
echo "$SSH_KEY_IXPAGE" > /root/.ssh/id_rsa_ixpage
chmod 600 /root/.ssh/id_rsa_ixpage
echo "$SSH_KEY_ARS" > /root/.ssh/id_rsa_ars
chmod 600 /root/.ssh/id_rsa_ars
echo "$IXLAN_OVPN_CONF" > /root/.ssh/ovpn-kskb-ix.conf
git config --global user.email [email protected]
git config --global user.name KusakabeSi
echo $HOME
echo $GITHUB_WORKSPACE
shell: bash
env:
SSH_KEY_IXPAGE: ${{secrets.SSH_KEY_IXPAGE}}
SSH_KEY_ARS: ${{secrets.SSH_KEY_ARS}}
IXLAN_OVPN_CONF: ${{secrets.IXLAN_OVPN_CONF}}
- name: Cache /root/.local 20230605
id: cache_pip
uses: actions/cache@v2
with:
path: |
/root/.local/lib
/root/.local/bin
/root/.local/share
key: /root/.local/items at PoemaIX-BIRDGen all
- name: Install depends
run: sudo apt-get install -y bgpq4 openvpn net-tools
- name: connect to openvpn
run: |
sudo openvpn --daemon --config /root/.ssh/ovpn-kskb-ix.conf
- name: Get current time
uses: gerred/actions/current-time@master
id: current-time
- name: Cache /root/gitrs 20230605
id: cache_ix_page
uses: actions/cache@v2
with:
path: |
/root/gitrs
/root/arouteserver/cache
key: /root/gitrs at PoemaIX-BIRDGen all v2
- name: Sync from /root/gitrs
if: steps.cache_ix_page.outputs.cache-hit != 'true'
run: |
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa_ixpage"
git clone [email protected]:PoemaIX/KSKB-IX.git /root/gitrs/KSKB-IX
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa_ars"
git clone [email protected]:PoemaIX/arouteserver.git /root/gitrs/ars
git clone https://github.com/PoemaIX/RIPE-AS-SET-SYNC.git /root/gitrs/RIPE-AS-SET-SYNC
- name: reset to girts origin
run: |
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa_ixpage"
cd /root/gitrs/KSKB-IX
git fetch --all --force
git reset --hard origin/main
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa_ars"
cd /root/gitrs/ars
git fetch --all --force
git reset --hard origin/KSKB-IX
cd /root/gitrs/RIPE-AS-SET-SYNC
cd /root/gitrs/KSKB-IX
git fetch --all --force
git reset --hard origin/main
- name: regenerate bird config
run: |
pip3 install -r /root/gitrs/ars/requirements.txt
/root/arouteserver/scripts/gen_rs.sh
env:
SECRET_PEERINGDB_API_KEY: ${{secrets.SECRET_PEERINGDB_API_KEY}}
PIP_BREAK_SYSTEM_PACKAGES: 1
HOME: /root
shell: bash
- name: push ixpage back
run: |
pip3 install mkdocs-bootswatch pymdown-extensions mkdocs-material jieba
git config --global user.email [email protected]
git config --global user.name KusakabeSi
/root/arouteserver/scripts/sync_asset.sh
/root/arouteserver/scripts/sync_ixpage.sh -b
env:
HOME: /root
RIPE_PASSWD: ${{secrets.RIPE_PASSWD}}
GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa_ixpage"
PIP_BREAK_SYSTEM_PACKAGES: 1
shell: bash
- name: Commit
run: |
cd $GITHUB_WORKSPACE
git add -A
git diff-index --quiet HEAD || git commit -m "update" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master