-
Notifications
You must be signed in to change notification settings - Fork 5
78 lines (75 loc) · 2.78 KB
/
on-demand-contentful-restore.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Restore Contentful from backup
on:
workflow_dispatch:
inputs:
environment:
required: true
description: Backup source environment to restore
type: choice
options:
- Production
- Development
app:
required: true
description: CRN or GP2
type: choice
options:
- crn
- gp2
backup-version:
required: false
description: Backup file to restore - leave blank for latest
type: string
contentful-env:
required: false
type: string
description: Contentful environment to restore into - leave blank to use Production/Development as selected above
jobs:
restore-backup:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
container:
image: ghcr.io/yldio/asap-hub/node-python-sq:7b77d99657ab3718ed548ba366ffbcbb15315fd8
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
id: setup
uses: ./.github/actions/setup-environment
with:
environment-name: ${{ inputs.environment }}
- name: Determine Environment
id: determine-environment
shell: bash
run: |
CONTENTFUL_ENV=$CONTENTFUL_MASTER_ENV
BRANCH_ENV=false
if [[ "$APP" == "gp2" ]]
then
CONTENTFUL_SPACE_ID=$GP2_CONTENTFUL_SPACE_ID
BUCKET_NAME=$GP2_BUCKET_NAME
else
CONTENTFUL_SPACE_ID=$CRN_CONTENTFUL_SPACE_ID
BUCKET_NAME=$CRN_BUCKET_NAME
fi
echo "contentful-space-id=$CONTENTFUL_SPACE_ID" >> $GITHUB_OUTPUT
echo "bucket-name=$BUCKET_NAME" >> $GITHUB_OUTPUT
env:
APP: ${{ inputs.app }}
CRN_BUCKET_NAME: ${{ steps.setup.outputs.crn-contentful-backup-bucket-name }}
CRN_CONTENTFUL_SPACE_ID: ${{ steps.setup.outputs.crn-contentful-space-id }}
GP2_BUCKET_NAME: ${{ steps.setup.outputs.gp2-contentful-backup-bucket-name }}
GP2_CONTENTFUL_SPACE_ID: ${{ steps.setup.outputs.gp2-contentful-space-id }}
- name: restore backup
uses: ./.github/actions/contentful-restore
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
bucket-name: ${{ steps.determine-environment.outputs.bucket-name }}
backup-version: ${{ inputs.backup-version }}
contentful-space-id: ${{ steps.determine-environment.outputs.contentful-space-id }}
contentful-environment: ${{ inputs.contentful-env || inputs.environment }}
contentful-token: ${{ secrets.CONTENTFUL_MANAGEMENT_TOKEN }}