Backup status.db #10589
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Backup the status.db daily | |
# because status.db contains important info!! | |
# we can always regenerate orchard.db, but not status.db | |
name: Backup status.db | |
# Controls when the workflow will run | |
on: | |
# once a day | |
schedule: | |
- cron: '30 * * * *' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
backup: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: install litestream | |
run: wget https://github.com/benbjohnson/litestream/releases/download/v0.3.9/litestream-v0.3.9-linux-amd64.deb && sudo dpkg -i litestream-v0.3.9-linux-amd64.deb | |
- name: print litestream version | |
run: litestream version | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: get the file from litestream | |
run: litestream restore -v -config orchard/bot/litestream.yml ./status.db | |
env: | |
KEY_ID: ${{ secrets.B2_KEY_ID }} | |
B2_ACCESS_KEY: ${{ secrets.B2_APPLICATION_KEY }} | |
LITESTREAM_PATH: status-main | |
LITESTREAM_DB: ./status.db | |
- name: install b2 | |
run: pipx install b2 | |
- name: configure b2 | |
run: b2 authorize-account $B2_KEY_ID $B2_APPLICATION_KEY | |
env: | |
B2_APPLICATION_KEY: ${{ secrets.B2_APPLICATION_KEY }} | |
B2_KEY_ID: ${{ secrets.B2_KEY_ID }} | |
- name: print b2 account info | |
run: b2 get-account-info | |
- name: shasum of it | |
run: sha1sum status.db | |
- name: upload to b2 | |
run: b2 upload-file rdsqlite status.db backups/status.db |