forked from theHandsomestNerd/mixed-feelings-by-t
-
Notifications
You must be signed in to change notification settings - Fork 5
36 lines (34 loc) · 1.21 KB
/
sanity-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
name: Backup Sanity db
on:
schedule:
# Runs at 04:00 UTC on the 1st and 17th of every month
- cron: '0 4 */16 * *'
workflow_dispatch:
jobs:
export_upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: |
cd sanityIo
npm install
set -e
# Put your environment variables here. Don't forget
# to create secrets for them on GitHub:
# https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
cat << EOF > .env.production
EOF
# Make sure to add a secret for SANITY_AUTH_TOKEN
SANITY_AUTH_TOKEN="${{ secrets.SANITY_AUTH_TOKEN }}" npx @sanity/cli dataset export production backups/backup.tar.gz
- name: Upload backup.tar.gz
uses: actions/upload-artifact@v3
with:
name: backup-tarball
path: sanityIo/backups/backup.tar.gz
# Fails the workflow if no files are found; defaults to 'warn'
if-no-files-found: error