-
Notifications
You must be signed in to change notification settings - Fork 2
53 lines (45 loc) · 1.45 KB
/
workflow.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
name: Generate Anki Packages
on:
push:
branches:
- main
- parser-rewrite
paths-ignore:
- 'README.md'
- 'LICENSE'
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.x environment
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Set up private key
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
mkdir -p $HOME/.ssh
echo "$SSH_PRIVATE_KEY" | base64 --decode > $HOME/.ssh/id_ed25519
chmod 600 $HOME/.ssh/id_ed25519
ssh-keyscan -H ${{ secrets.MIRROR_IP }} >> $HOME/.ssh/known_hosts
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends zip git python3-dev
python -m venv venv
source venv/bin/activate
git clone https://github.com/hmelder/AnkiTUM-Runtime
pip install setuptools click~=8.1.3 PyYAML~=6.0 genanki~=0.13.1 Pillow~=9.4.0 Jinja2~=3.1.2 packaging~=23.0
pip install ./AnkiTUM-Runtime
- name: Generate Anki packages and compress
run: |
source venv/bin/activate
./build.sh
- name: Upload via SFTP
env:
MIRROR_IP: ${{ secrets.MIRROR_IP }}
MIRROR_USER: ${{ secrets.MIRROR_USER }}
run: |
sftp -i $HOME/.ssh/id_rsa $MIRROR_USER@$MIRROR_IP:/var/www/html/anki-decks/beta <<< $'put -r build/*.zip'