-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (57 loc) · 1.95 KB
/
update-motors.yml
File metadata and controls
70 lines (57 loc) · 1.95 KB
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
name: Update Motor Database
on:
schedule:
# Run at 02:00 every Sunday
- cron: '0 2 * * 0'
workflow_dispatch:
permissions:
contents: write
jobs:
update-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Dependencies
run: pip install -r scripts/requirements.txt
- name: Fetch New Motors
run: python scripts/fetch_updates.py
- name: Build Database
run: python scripts/build_database.py
- name: Install Crypto Lib
run: pip install cryptography
- name: Sign Database Update
env:
MOTOR_DB_PRIVATE_KEY_BASE64: ${{ secrets.MOTOR_DB_PRIVATE_KEY_BASE64 }}
MOTOR_DB_KEY_ID: ${{ secrets.MOTOR_DB_KEY_ID }}
run: python scripts/sign_database.py motors.db.gz metadata.json
- name: Commit Raw Data Changes
# This saves the downloaded .eng files back to the repo
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Auto-update motor cache [skip ci]"
file_pattern: "data/ state/"
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./
keep_files: false
# We only want to publish the artifacts, not the whole repo
exclude_assets: "scripts,schema,data,.github"
# Or better, move artifacts to a 'public' folder and publish that:
- name: Prepare Publish Folder
run: |
mkdir public
mv motors.db.gz public/
mv metadata.json public/
- name: Deploy Artifacts
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
force_orphan: true