DEV - Build & deploy studio v3 #108
This file contains 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: DEV - Build & deploy studio v3 | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- staging | |
paths: | |
- 'sanityv3/**/*' | |
- './FeatureFlags.js' | |
- '!./README.md' | |
- '!./.env.development.template' | |
permissions: | |
id-token: write | |
packages: write | |
jobs: | |
check-code: | |
runs-on: ubuntu-latest | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/checkout@v3 | |
with: | |
ref: staging | |
- name: Install pnpm π¦ | |
id: install-pnpm | |
uses: pnpm/[email protected] | |
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 | |
# @TODO: Enable ESlint for v3 | |
# - name: Run ESLint π | |
# id: lint | |
# run: | | |
# pnpm lint:studio | |
- uses: act10ns/slack@v1 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
if: failure() | |
update-radix-config: | |
needs: check-code | |
runs-on: ubuntu-latest | |
environment: | |
name: development | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/checkout@v3 | |
with: | |
ref: staging | |
- 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 DEV on staging branch ποΈ | |
if: github.ref == 'refs/heads/staging' | |
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 studio to dev 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() | |
deploy-studio: | |
needs: check-code | |
runs-on: ubuntu-latest | |
environment: | |
name: development | |
url: https://studiov3-global-development-energyvision-dev.radix.equinor.com/ | |
strategy: | |
matrix: | |
dataset: [global-development] | |
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/studiov3-${{ 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 }} | |
- uses: act10ns/slack@v1 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
if: failure() |