Backup sanity dateset to gcp #274
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 sanity dateset to gcp | |
on: | |
workflow_dispatch: | |
schedule: | |
# 12.00 every 3 days | |
- cron: "0 0 */3 * *" | |
jobs: | |
execute: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required to retrieve git history | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: yarn | |
- name: set-env for yarn install to @navikt scope | |
shell: bash | |
run: echo "NPM_AUTH_TOKEN=${{ secrets.READER_TOKEN }}" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: cd aksel.nav.no/website && yarn | |
- name: Create empty .env file (Can be removed when env-file-if-exists is implemented in node v22) | |
run: echo "" > ./aksel.nav.no/website/.env | |
- name: Export dataset | |
env: | |
SANITY_READ: ${{ secrets.SANITY_READ }} | |
run: cd aksel.nav.no/website && yarn backup | |
- name: Upload GCP bucket | |
uses: "google-github-actions/auth@v2" | |
with: | |
credentials_json: "${{ secrets.gcp_credentials_prod }}" | |
- uses: "google-github-actions/upload-cloud-storage@v2" | |
with: | |
path: ./aksel.nav.no/website | |
destination: "aksel-website-prod/backups" | |
glob: "backup-*.tar.gz" |