-
Notifications
You must be signed in to change notification settings - Fork 8
152 lines (145 loc) Β· 5.08 KB
/
PREPROD-webs.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: PREPROD - Build & Deploy all webs
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'web/**'
- '!web/README.md'
- '!web/.storybook/**'
- '!web/.gitignore'
- '!web/jest.config.cjs'
- '!web/jest.setup.ts'
- './FeatureFlags.js'
- '!web/components/README.md'
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 web ${{ 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 webs to preprod with tag ${{ env.IMAGE_TAG_SHA }}" --allow-empty
git pull --rebase origin main
git push origin HEAD:main
fi
- uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()
deploy-secret:
needs: update-radix-config
runs-on: ubuntu-latest
environment:
name: preprod
url: https://web-secret-energyvision-preprod.radix.equinor.com/
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
DOCKER_BUILDKIT: 1
steps:
- name: Checkout ποΈ
uses: actions/checkout@v3
- id: deploy-secret
uses: ./.github/workflows/deploy-websites/
with:
imageName: ghcr.io/equinor/energyvision/web-secret
projectId: w3b4om14
datasetName: secret
githubToken: ${{ secrets.GITHUB_TOKEN }}
sanityApiToken: ${{ secrets.SANITY_API_SECRET_TOKEN }}
sanityPreviewSecret: ${{ secrets.SANITY_STUDIO_SECRET_PREVIEW_SECRET }}
algoliaAppId: ${{ secrets.ALGOLIA_APP_ID }}
algoliaApiKey: ${{ secrets.ALGOLIA_SEARCH_API_KEY }}
environment: ${{ secrets.ENV }}
archiveContentLink: ${{ vars.ARCHIVE_CONTENT_LINK }}
- 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-sites:
needs: [update-radix-config, read-satellites]
runs-on: ubuntu-latest
environment:
name: preprod
strategy:
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
- name: Deploy website π
id: deploy-website
uses: ./.github/workflows/deploy-websites/
with:
imageName: ghcr.io/equinor/energyvision/web-${{ matrix.dataset }}
datasetName: ${{ matrix.dataset }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
sanityApiToken: ${{ secrets.SANITY_API_TOKEN }}
sanityPreviewSecret: ${{ secrets.SANITY_STUDIO_PREVIEW_SECRET }}
algoliaAppId: ${{ secrets.ALGOLIA_APP_ID }}
algoliaApiKey: ${{ secrets.ALGOLIA_SEARCH_API_KEY }}
dynatraceEnvironment: ${{ secrets.DYNATRACE_ENVIRONMENT }}
dynatracePaaSToken: ${{ secrets.DYNATRACE_PAAS_TOKEN }}
dynatraceImage: ${{ secrets.DYNATRACE_PREPROD_IMAGE }}
environment: ${{ secrets.ENV }}
archiveContentLink: ${{ vars.ARCHIVE_CONTENT_LINK }}
- uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()