2020-05-01 15:06:14 +08:00
|
|
|
# This is a basic workflow to help you get started with Actions
|
|
|
|
|
|
|
|
name: roa_generator
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ master ]
|
2020-05-01 15:45:25 +08:00
|
|
|
schedule:
|
|
|
|
- cron: '0 6 * * 1'
|
2020-05-01 15:06:14 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Generate ROA
|
2020-05-12 11:12:00 +08:00
|
|
|
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
2020-05-01 15:06:14 +08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@master
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
sudo apt update -qq
|
|
|
|
sudo apt install -y python3 git openssh-client
|
2020-05-13 21:32:58 +08:00
|
|
|
sudo apt install -y curl
|
|
|
|
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
|
|
|
|
export PATH="$HOME/.pyenv/bin:$PATH"
|
|
|
|
eval "$(pyenv init -)"
|
|
|
|
eval "$(pyenv virtualenv-init -)"
|
|
|
|
pyenv install 3.8.2
|
|
|
|
pyenv shell 3.8.2
|
2020-05-01 15:06:14 +08:00
|
|
|
|
|
|
|
- name: Run roa script
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2020-05-13 21:32:58 +08:00
|
|
|
export PATH="$HOME/.pyenv/bin:$PATH"
|
|
|
|
eval "$(pyenv init -)"
|
|
|
|
eval "$(pyenv virtualenv-init -)"
|
2020-05-13 21:40:37 +08:00
|
|
|
pyenv shell 3.8.2
|
2020-05-02 17:02:38 +08:00
|
|
|
maxlen4=29
|
2020-05-01 15:06:14 +08:00
|
|
|
maxlen6=64
|
|
|
|
mkdir -p roa_dir
|
2020-05-13 21:32:58 +08:00
|
|
|
pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -o roa_dir/roa46_bird2.conf
|
|
|
|
pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -4 -o roa_dir/roa4_bird2.conf
|
|
|
|
pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -6 -o roa_dir/roa6_bird2.conf
|
|
|
|
pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -j -o roa_dir/roa46.json
|
|
|
|
pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -e -o roa_dir/neonetwork.json
|
|
|
|
pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -r -o roa_dir/rfc8416.json
|
2020-05-01 15:06:14 +08:00
|
|
|
|
|
|
|
- name: Upload files
|
|
|
|
env:
|
|
|
|
SSHPRIVKEY: ${{ secrets.KEY }}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cd roa_dir
|
|
|
|
[ -n "$SSHPRIVKEY" ] || (echo SSHPRIVKEY is not set; exit 1)
|
|
|
|
( set -e;
|
2020-05-01 15:22:17 +08:00
|
|
|
mkdir -p ~/.ssh
|
2020-05-01 15:06:14 +08:00
|
|
|
echo "$SSHPRIVKEY" |base64 -d > ~/.ssh/id_ed25519
|
|
|
|
chmod 0600 ~/.ssh/id_ed25519
|
|
|
|
ssh -o StrictHostKeyChecking=no git@github.com || true
|
2020-05-01 15:22:17 +08:00
|
|
|
git init && git add .
|
2020-05-01 15:06:14 +08:00
|
|
|
git config user.name "neonet roa bot"
|
|
|
|
git config user.email "bot@github.com"
|
|
|
|
git commit -m "Generated at $(TZ='UTC' date +%Y%m%d-%H%M%S.%N)"
|
|
|
|
git push --force --quiet "git@github.com:NeoCloud/NeoNetwork-ROA.git" HEAD:master
|
|
|
|
) || (shred ~/.ssh/id_ed25519; exit 1)
|
|
|
|
shred ~/.ssh/id_ed25519
|