Backup Routine #76
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
name: Backup Routine | |
on: | |
workflow_dispatch: | |
schedule: | |
# Runs at 04:00 UTC on the 1st and 17th of every month | |
- cron: "0 4 */16 * *" | |
jobs: | |
backup-prod-dataset: | |
runs-on: ubuntu-20.04 | |
name: Backup prod dataset | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
yarn | |
- name: Export prod dataset | |
run: | | |
SANITY_AUTH_TOKEN="${{ secrets.SANITY_VIEWER_TOKEN }}" \ | |
npx sanity dataset export \ | |
production backups/baks-soknad-prod.tar.gz | |
- name: Upload baks-soknad-prod.tar.gz | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Backup prod dataset | |
path: backups/baks-soknad-prod.tar.gz | |
# Fails the workflow if no files are found; defaults to 'warn' | |
if-no-files-found: error | |
- name: Import prod dataset til test | |
run: | | |
SANITY_AUTH_TOKEN="${{ secrets.SANITY_WRITE_TOKEN }}" \ | |
npx sanity dataset import \ | |
backups/baks-soknad-prod.tar.gz test --replace |