-
Notifications
You must be signed in to change notification settings - Fork 2
104 lines (99 loc) · 3.55 KB
/
Copy pathUPGRADE-PREPROD-webs.yaml
File metadata and controls
104 lines (99 loc) · 3.55 KB
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
name: UPGRADE PREPROD - Build & Deploy all webs
on:
workflow_dispatch:
push:
branches:
- upgrade-next-intl
paths:
- 'web/**'
- '!web/README.md'
- '!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@v4
- 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@v4
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/upgrade-next-intl'
shell: bash
id: modify-radix
run: |
# Install pre-requisite
python3 -m venv venv
source venv/bin/activate
python -m pip install ruamel.yaml
python ci/upgradeEnvironment.py web-upgrade ${{ env.IMAGE_TAG_SHA }} ${{ secrets.ENV }}
git config --global user.name 'github'
git config --global user.email 'padms@users.noreply.github.com'
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-all-sites:
needs: [update-radix-config]
runs-on: ubuntu-latest
environment:
name: preprod
strategy:
fail-fast: false
matrix:
dataset: ['global', 'argentina']
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
DOCKER_BUILDKIT: 1
steps:
- name: Checkout 🔔
uses: actions/checkout@v4
- name: Deploy website 🌐
id: deploy-website
uses: ./.github/workflows/deploy-web/
with:
projectId: h61q9gi9
imageName: ghcr.io/equinor/energyvision/web-${{ matrix.dataset }}-upgrade
datasetName: ${{ matrix.dataset }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
sanityApiToken: ${{ secrets.SANITY_API_TOKEN }}
algoliaAppId: ${{ vars.ALGOLIA_APP_ID }}
algoliaApiKey: ${{ vars.ALGOLIA_SEARCH_API_KEY }}
environment: ${{ vars.ENV }}
archiveContentLink: ${{ vars.ARCHIVE_CONTENT_LINK }}
friendlyCaptchaSitekey: ${{ matrix.dataset == 'brazil' && vars.BRAZIL_FC_SITEKEY || vars.GLOBAL_FC_SITEKEY }}
friendlyCaptchaPuzzleEndpoint: ${{ matrix.dataset == 'brazil' && vars.BRAZIL_FC_PUZZLE_END_POINT || vars.GLOBAL_FC_PUZZLE_END_POINT }}
componentSuffix: 'upgrade'
- uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()