PROD - Deploy all studios #83
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PROD - Deploy all studios | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true' | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| jobs: | |
| deploy-global: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: production | |
| url: https://equinor.sanity.studio | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| 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_FOTOWARE_REDIRECT_URI: ${{ secrets.SANITY_STUDIO_FOTOWARE_REDIRECT_URI }} | |
| 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@v6 | |
| with: | |
| repository: 'equinor/energyvision-internal' | |
| ref: main | |
| token: ${{ secrets.PADMS_PAT }} | |
| - name: Get preprod sha π·οΈ | |
| id: get-preprod-sha | |
| shell: bash | |
| run: | | |
| # Install pre-requisite | |
| 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@v6 | |
| with: | |
| repository: 'equinor/energyvision' | |
| fetch-depth: 0 | |
| # ref: '${{ steps.get-preprod-sha.outputs.sha }}' | |
| - 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@v6 | |
| 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 | |
| - name: Cache pnpm modules πΎ | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: 'pnpm' | |
| - name: Install dependencies π§ | |
| id: install-dependencies | |
| run: | | |
| pnpm install | |
| pnpm studio install | |
| - name: Deploy π | |
| id: deploy | |
| working-directory: ./studio | |
| run: | | |
| pnpm run deploy | |
| env: | |
| SANITY_AUTH_TOKEN: ${{ secrets.SANITY_DEPLOY }} | |
| - uses: act10ns/slack@v2 | |
| with: | |
| status: ${{ job.status }} | |
| steps: ${{ toJson(steps) }} | |
| if: failure() | |
| deploy-secret: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: production | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| SANITY_STUDIO_API_PROJECT_ID: w3b4om14 | |
| SANITY_STUDIO_API_DATASET: secret | |
| 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 }} | |
| SANITY_STUDIO_FOTOWARE_REDIRECT_URI: ${{ secrets.SANITY_STUDIO_FOTOWARE_REDIRECT_URI }} | |
| DOCKER_BUILDKIT: 1 | |
| steps: | |
| - name: Checkout internal ποΈ | |
| id: checkout-internal | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: 'equinor/energyvision-internal' | |
| ref: main | |
| token: ${{ secrets.PADMS_PAT }} | |
| - name: Get preprod sha π·οΈ | |
| id: get-preprod-sha | |
| shell: bash | |
| run: | | |
| # Install pre-requisite | |
| python -m pip install --user ruamel.yaml | |
| echo "sha=$(python ci/returnGlobalStudioVersion.py preprod)" >> $GITHUB_OUTPUT | |
| - name: Checkout ποΈ | |
| id: checkout-main | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: 'equinor/energyvision' | |
| fetch-depth: 0 | |
| # ref: '${{ steps.get-preprod-sha.outputs.sha }}' | |
| - 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@v6 | |
| 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 | |
| - name: Cache pnpm modules πΎ | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: 'pnpm' | |
| - name: Install dependencies π§ | |
| id: install-dependencies | |
| run: | | |
| pnpm install | |
| pnpm studio install | |
| - name: Deploy π | |
| id: deploy | |
| working-directory: ./studio | |
| run: | | |
| pnpm run deploy | |
| env: | |
| SANITY_AUTH_TOKEN: ${{ secrets.SANITY_SECRET_DEPLOY }} | |
| - uses: act10ns/slack@v2 | |
| with: | |
| status: ${{ job.status }} | |
| steps: ${{ toJson(steps) }} | |
| if: failure() | |
| 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@v6 | |
| 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: 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 studio | |
| 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 all 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-satellite-studios: | |
| needs: update-radix-config | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: production | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| DOCKER_BUILDKIT: 1 | |
| steps: | |
| - name: Checkout ποΈ | |
| uses: actions/checkout@v6 | |
| # PRODUCTION CLUSTERS | |
| - name: Deploy to Radix π | |
| id: deploy | |
| uses: equinor/radix-github-actions@v2 | |
| with: | |
| azure_client_id: 460b889f-89e0-4cc9-965c-31f3e7770226 | |
| version: latest | |
| - run: rx create job deploy | |
| --context platform2 | |
| -a equinor-web-sites | |
| -e ${{ secrets.ENV }} | |
| -f | |
| shell: bash | |
| - uses: act10ns/slack@v2 | |
| with: | |
| status: ${{ job.status }} | |
| steps: ${{ toJson(steps) }} | |
| if: failure() | |
| store-image-tags: | |
| needs: [deploy-satellite-studios, deploy-global, deploy-secret] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout internal ποΈ | |
| id: checkout-internal | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: 'equinor/energyvision-internal' | |
| ref: main | |
| token: ${{ secrets.PADMS_PAT }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' # Or any version you prefer | |
| - name: Install dependencies | |
| run: | | |
| npm install js-yaml | |
| - name: Run script for 'studio' | |
| run: | | |
| STUDIO_SHA=$(node ci/storeImageTags.js studio) | |
| echo "STUDIO_SHA=$(STUDIO_SHA)" >> $GITHUB_OUTPUT | |
| - name: Commit and push changes | |
| run: | | |
| 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 | |
| git add latest-prod-tags.json | |
| git commit -m "Update latest-prod-tags.json with new tags" || echo "No changes to commit" | |
| git push | |
| create-discussion-and-share: | |
| needs: [store-image-tags] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout ποΈ | |
| uses: actions/checkout@v6 | |
| - name: 'Move cards and create discussion and post it to channel' | |
| id: 'get-list' | |
| with: | |
| token: ${{ secrets.PADMS_PAT_READ_PACKAGE }} | |
| commitSHA: 'Studio: ${{ needs.store-image-tags.outputs.STUDIO_SHA }}' | |
| slackWebhook: ${{ secrets.SLACK_WEBHOOK_RELEASE_ANNOUNCEMENT}} | |
| uses: ./.github/workflows/project/ |