-
Notifications
You must be signed in to change notification settings - Fork 2
64 lines (57 loc) · 1.97 KB
/
backup.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
name: Backup
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
jobs:
backup:
runs-on: ubuntu-latest
name: Backup DB
steps:
- name: Checkout contents repo
uses: actions/checkout@v4
with:
token: ${{ secrets.DWARVES_PAT }}
submodules: recursive
fetch-depth: 5
- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
devbox-version: 0.13.3
- name: Export DB
shell: bash
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
devbox run duckdb-export
mkdir backup
tar -czvf ./backup/$(date +%Y-%m-%d).tar.gz db
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
INFINITY_API_KEY: ${{ secrets.INFINITY_API_KEY }}
INFINITY_OPENAI_BASE_URL: ${{ secrets.INFINITY_OPENAI_BASE_URL }}
JINA_API_KEY: ${{ secrets.JINA_API_KEY }}
JINA_BASE_URL: ${{ secrets.JINA_BASE_URL }}
- name: Upload latest db for querying
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SOURCE_DIR: db
DEST_DIR: db
- name: Upload backup to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --follow-symlinks
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SOURCE_DIR: backup
DEST_DIR: db/backup