-
Notifications
You must be signed in to change notification settings - Fork 5
36 lines (31 loc) · 1.09 KB
/
sync_databases.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
name: Sync databases
on:
workflow_dispatch:
env:
DUPLICATE_API_TOKEN: ${{ secrets.DUPLICATE_API_TOKEN }}
PRODUCTION_APP: ${{ secrets.SCALINGO_PRODUCTION_APP }}
PREPROD_APP: ${{ secrets.SCALINGO_PREPROD_APP }}
PREPROD_DATABASE_URL: ${{ secrets.PREPROD_DATABASE_URL }}
defaults:
run:
shell: bash
jobs:
sync_prod_to_preprod:
name: Sync production databsse to preprod
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Scalingo CLI
run: |
curl -O https://cli-dl.scalingo.com/install && bash install
- name: Login Scalingo CLI
run: scalingo login --api-token "${DUPLICATE_API_TOKEN}"
- name: Execute sync script in one-off container
run: |
scalingo --app ${PREPROD_APP} run \
--env DUPLICATE_API_TOKEN="${DUPLICATE_API_TOKEN}" \
--env PREPROD_DATABASE_URL="${PREPROD_DATABASE_URL}" \
--env PRODUCTION_APP="${PRODUCTION_APP}" \
--file ./scripts/restore_prod_to_preprod.sh \
/tmp/uploads/restore_prod_to_preprod.sh