Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 add workflow file for all studios and web #2672 #2673

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
226 changes: 226 additions & 0 deletions .github/workflows/PROD-all-webs-and-studios.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
name: PROD - Deploy all webs and studios
on:
workflow_dispatch:
permissions:
id-token: write
jobs:
update-radix-config:
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- name: Checkout internal 🛎️
id: checkout-internal
uses: actions/checkout@v3
with:
repository: 'equinor/energyvision-internal'
ref: main
token: ${{ secrets.PADMS_PAT }}
- name: Promote preprod tag to prod 🗒️
if: github.ref == 'refs/heads/main'
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/promoteAllToProduction.py web
python ci/promoteAllToProduction.py studio
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 all web sites and studios to production"
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-webs:
needs: update-radix-config
runs-on: ubuntu-latest
environment:
name: production
url: https://equinor.com
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
DOCKER_BUILDKIT: 1
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Get token 🔑
id: get-token
uses: ./.github/workflows/get-auth-token/

- name: Deploy to Radix 🚀
id: deploy-main
uses: equinor/radix-github-actions@master
with:
args: >
create job
deploy
--token-environment
--context platform2
-a equinor-web-sites
-e ${{ secrets.ENV }}
-f

- uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()

deploy-studios:
needs: update-radix-config
runs-on: ubuntu-latest
environment:
name: production
url: https://equinor.sanity.studio
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SANITY_STUDIO_BRANDMASTER_URL: ${{ secrets.SANITY_STUDIO_BRANDMASTER_URL }}
SANITY_STUDIO_BRANDMASTER_PLUGIN_SOURCE: ${{ secrets.SANITY_STUDIO_BRANDMASTER_PLUGIN_SOURCE }}
SANITY_STUDIO_PREVIEW_SECRET: ${{ secrets.SANITY_STUDIO_PREVIEW_SECRET }}
SANITY_STUDIO_HISTORY_API_TOKEN: ${{ secrets.SANITY_STUDIO_HISTORY_API_TOKEN }}
SANITY_STUDIO_API_DATASET: global
SANITY_STUDIO_FOTOWARE_CLIENT_ID: ${{ secrets.SANITY_STUDIO_FOTOWARE_CLIENT_ID }}
SANITY_STUDIO_FOTOWARE_TENANT_URL: ${{ secrets.SANITY_STUDIO_FOTOWARE_TENANT_URL }}
SANITY_STUDIO_FOTOWARE_REDIRECT_ORIGIN: ${{ secrets.SANITY_STUDIO_FOTOWARE_REDIRECT_ORIGIN }}
SANITY_STUDIO_FOTOWARE_AF_EXPORT_URL: ${{ secrets.SANITY_STUDIO_FOTOWARE_AF_EXPORT_URL }}
SANITY_STUDIO_FOTOWARE_AF_EXPORT_KEY: ${{ secrets.SANITY_STUDIO_FOTOWARE_AF_EXPORT_KEY }}
SANITY_STUDIO_SCREEN9_ACCOUNT_ID: ${{ secrets.SANITY_STUDIO_SCREEN9_ACCOUNT_ID }}
SANITY_STUDIO_SCREEN9_TOKEN: ${{ secrets.SANITY_STUDIO_SCREEN9_TOKEN }}
DOCKER_BUILDKIT: 1
steps:
- name: Checkout internal 🛎️
id: checkout-internal
uses: actions/checkout@v3
with:
repository: 'equinor/energyvision-internal'
ref: main
token: ${{ secrets.PADMS_PAT }}
- name: Get preprod sha 🏷️
id: get-preprod-sha
shell: bash
run: |
python -m pip install --user ruamel.yaml
echo "sha=$(python ci/returnComponentVersion.py preprod studio-global)" >> $GITHUB_OUTPUT
- name: Checkout 🛎️
id: checkout-main
uses: actions/checkout@v3
with:
repository: 'equinor/energyvision'
fetch-depth: 0
- name: Get long sha ️🏷️
id: get-long-sha
shell: bash
run: |
echo "sha=$(git rev-parse ${{ steps.get-preprod-sha.outputs.sha }})" >> $GITHUB_OUTPUT
- name: Checkout 🛎️
id: checkout-specific-branch
uses: actions/checkout@v3
with:
repository: 'equinor/energyvision'
fetch-depth: 0
ref: '${{ steps.get-long-sha.outputs.sha }}'
- name: Install pnpm 📦
id: install-pnpm
uses: pnpm/action-setup@v4
with:
version: '8.5.1'
- name: Cache pnpm modules 💾
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
- name: Install dependencies 🔧
id: install-dependencies
run: |
pnpm install
pnpm sanityv3 install
- name: Deploy 🚀
id: deploy
working-directory: ./sanityv3
run: |
pnpm run deploy
env:
SANITY_AUTH_TOKEN: ${{ secrets.SANITY_DEPLOY }}
- uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy Studios for satellites sites missing.

deploy-satellite-studios:
needs: deploy-studios
runs-on: ubuntu-latest
environment:
name: production
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
DOCKER_BUILDKIT: 1
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Get token 🔑
id: get-token
uses: ./.github/workflows/get-auth-token/

- name: Deploy to Radix 🚀
id: deploy
uses: equinor/radix-github-actions@master
with:
args: >
create job
deploy
--token-environment
--context platform2
-a equinor-web-sites
-e ${{ secrets.ENV }}
-f

- uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()

store-image-tags:
needs: [deploy-webs, deploy-satellite-studios]
runs-on: ubuntu-latest
steps:
- name: Checkout internal 🛎️
id: checkout-internal
uses: actions/checkout@v3
with:
repository: 'equinor/energyvision-internal'
ref: main
token: ${{ secrets.PADMS_PAT }}
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
run: |
npm install js-yaml
- name: Run script for 'web' and 'studio'
run: |
node ci/storeImageTags.js web
node ci/storeImageTags.js studio
- name: Commit and push changes
run: |
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
git add latest-prod-tags.json
git commit -m "Update latest-prod-tags.json with new tags" || echo "No changes to commit"
git push
Loading