-
Notifications
You must be signed in to change notification settings - Fork 8
123 lines (117 loc) · 4.34 KB
/
PREPROD-studios-v3.yaml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: PREPROD - Build & deploy all studios v3
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'sanityv3/**/*'
- './FeatureFlags.js'
- '!./README.md'
- '!./.env.development.template'
- '!./sanityv3/scripts/**/*'
permissions:
id-token: write
packages: write
jobs:
update-radix-config:
runs-on: ubuntu-latest
environment:
name: preprod
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Set image tag 🏷
shell: bash
id: set-default-image-tag
run: |
echo "IMAGE_TAG_SHA=$(git rev-parse --short=12 ${GITHUB_SHA})" >> $GITHUB_ENV
- name: Checkout internal 🛎️
id: checkout-internal
uses: actions/checkout@v3
with:
repository: 'equinor/energyvision-internal'
ref: main
token: ${{ secrets.PADMS_PAT }} # Replace with ssh as per https://stackoverflow.com/questions/60222741/github-actions-and-git-clone-issue
- name: Modify radixconfig tag for preprod on main branch 🗒️
if: github.ref == 'refs/heads/main'
shell: bash
id: modify-radix
run: |
# Install pre-requisite
python -m pip install --user ruamel.yaml
python ci/upgradeEnvironment.py studio ${{ env.IMAGE_TAG_SHA }} ${{ secrets.ENV }}
git config --global user.name 'github'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.PADMS_PAT }}@github.com/equinor/energyvision-internal
if [[ `git status --porcelain` ]]
then
git commit -am "🚀 Deploy studios to preprod for tag ${{ env.IMAGE_TAG_SHA }}"
git pull --rebase origin main
git push origin HEAD:main
fi
- uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()
read-satellites:
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- id: set-matrix
name: Read from satellites.json
run: |
MATRIX=$(cat satellites.json)
echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT
- uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()
deploy-all-studios:
needs: [update-radix-config, read-satellites]
runs-on: ubuntu-latest
environment:
name: preprod
strategy:
fail-fast: false
matrix:
dataset: ${{ fromJson(needs.read-satellites.outputs.matrix) }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
DOCKER_BUILDKIT: 1
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- id: deploy-satellite
uses: ./.github/workflows/deploy-v3/
with:
imageName: ghcr.io/equinor/energyvision/studio-${{ matrix.dataset }}
datasetName: ${{ matrix.dataset }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
sanityApiToken: ${{ secrets.SANITY_API_TOKEN }}
sanityHistoryApiToken: ${{ secrets.SANITY_STUDIO_HISTORY_API_TOKEN }}
sanityPreviewToken: ${{ secrets.SANITY_STUDIO_PREVIEW_SECRET }}
brandmasterUrl: ${{ secrets.SANITY_STUDIO_BRANDMASTER_URL }}
brandmasterPluginSource: ${{ secrets.SANITY_STUDIO_BRANDMASTER_PLUGIN_SOURCE }}
fotowareClientId: ${{ secrets.SANITY_STUDIO_FOTOWARE_CLIENT_ID }}
fotowareTenantUrl: ${{ secrets.SANITY_STUDIO_FOTOWARE_TENANT_URL }}
fotowareRedirectOrigin: ${{ secrets.SANITY_STUDIO_FOTOWARE_REDIRECT_ORIGIN }}
fotowareAfExportUrl: ${{ secrets.SANITY_STUDIO_FOTOWARE_AF_EXPORT_URL }}
fotowareAfExportKey: ${{ secrets.SANITY_STUDIO_FOTOWARE_AF_EXPORT_KEY }}
screen9accountId: ${{ secrets.SANITY_STUDIO_SCREEN9_ACCOUNT_ID }}
screen9token: ${{ secrets.SANITY_STUDIO_SCREEN9_TOKEN }}
environment: ${{ secrets.ENV }}
deployToBothClusters: true
- uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()