Skip to content

feat: update tokens from Tokens Studio release (#5182) #1189

feat: update tokens from Tokens Studio release (#5182)

feat: update tokens from Tokens Studio release (#5182) #1189

name: Publish core-react storybook
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment for the core-react storybook'
required: false
type: choice
options:
- production
- development
default: 'production'
push:
branches:
- main
paths:
- 'packages/eds-core-react/**'
- 'packages/eds-tokens/**'
- 'packages/eds-icons/**'
permissions:
contents: read
id-token: write
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
jobs:
setup:
uses: ./.github/workflows/_setup.yml
secrets: inherit
with:
cacheKey: ${{ github.sha }}
checkout_paths: packages apps scripts
packages:
name: Process packages
runs-on: ubuntu-latest
needs: [setup]
steps:
- name: Use "setup" cache
id: get-setup-cache
uses: actions/cache@v6
with:
path: |
./*
~/.pnpm-store
key: ${{ github.sha }}
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: '24.16.0'
- name: Setup pnpm
id: setup-pnpm
uses: pnpm/action-setup@v6
with:
run_install: false
- name: Build packages
id: build-packages
run: pnpm run build
- name: Build Storybook
id: build-storybook
run: |
echo Running build:storybook!
pnpm build:storybook
- name: Upload storybook build
uses: actions/upload-artifact@v7
with:
name: storybook-build
path: packages/eds-core-react/storybook-build
retention-days: 1
publish-storybook:
needs: [setup, packages]
name: Build & Deploy Website
runs-on: ubuntu-latest
environment:
name: ${{ github.event.inputs.environment || 'development' }}
steps:
- name: Download storybook build
uses: actions/download-artifact@v8
with:
name: storybook-build
path: packages/eds-core-react/storybook-build
- name: Debug - List downloaded files
run: |
echo "=== Downloaded files ==="
ls -la packages/eds-core-react/storybook-build/
echo ""
echo "=== Checking index.json for Foundation/Spacing ==="
if grep -q "foundation-spacing--selectable-padding" packages/eds-core-react/storybook-build/index.json; then
echo "✅ Foundation/Spacing SelectablePadding FOUND in index.json"
else
echo "❌ Foundation/Spacing SelectablePadding NOT FOUND in index.json"
fi
echo ""
echo "=== All Foundation/Spacing entries ==="
grep -o '"foundation-spacing--[^"]*"' packages/eds-core-react/storybook-build/index.json || echo "No Foundation/Spacing entries found"
- name: Az CLI login 🔑
uses: azure/login@v3
with:
client-id: d58b2e85-2d34-4cdb-ad70-5f2b767dd8e2
tenant-id: 3aa4a235-b6e2-48d5-9195-7fcf05b459b0
allow-no-subscriptions: true
- name: Delete all existing blobs to ensure clean deployment 🗑️
env:
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZ_STORYBOOK_CONNECTION_STRING }}
run: |
set -euo pipefail
echo "Checking existing blobs in container '\$web'..."
BLOB_COUNT=$(az storage blob list \
--container-name '$web' \
--connection-string "$AZURE_STORAGE_CONNECTION_STRING" \
--query 'length(@)' \
--output tsv)
if [ "$BLOB_COUNT" -eq 0 ]; then
echo "Container already empty."
else
echo "Deleting $BLOB_COUNT blobs..."
az storage blob delete-batch \
--source '$web' \
--pattern "*" \
--connection-string "$AZURE_STORAGE_CONNECTION_STRING" \
--output none
echo "Deletion request submitted."
fi
REMAINING=$(az storage blob list \
--container-name '$web' \
--connection-string "$AZURE_STORAGE_CONNECTION_STRING" \
--query 'length(@)' \
--output tsv)
echo "✅ Blob deletion completed. Remaining blobs: $REMAINING"
- name: Deploy to Azure Blob Storage 🚀
id: deploy-website
env:
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZ_STORYBOOK_CONNECTION_STRING }}
run: |
set -euo pipefail
echo "Deploying to Azure Blob Storage..."
# Verify source directory exists and has content
if [ ! -d "packages/eds-core-react/storybook-build" ]; then
echo "❌ Error: storybook-build directory not found"
exit 1
fi
FILE_COUNT=$(find packages/eds-core-react/storybook-build -type f | wc -l)
echo "Uploading $FILE_COUNT files..."
az storage blob upload-batch \
--destination '$web' \
--source packages/eds-core-react/storybook-build \
--overwrite \
--connection-string "$AZURE_STORAGE_CONNECTION_STRING"
# Verify upload
UPLOADED=$(az storage blob list \
--container-name '$web' \
--connection-string "$AZURE_STORAGE_CONNECTION_STRING" \
--query 'length(@)' \
--output tsv)
echo "✅ Deployment completed successfully. Total blobs in container: $UPLOADED"
- name: logout 🔓
run: az logout
if: always()
- name: log-errors-to-slack
uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()
purge-cdn:
needs: [publish-storybook]
# Only purge CDN for production. On push to main, environment is undefined,
# which correctly skips this job since dev storybook has no CDN.
if: github.event.inputs.environment == 'production'
name: Purge cdn
uses: ./.github/workflows/_purge_cdn.yaml
secrets: inherit
with:
environment: production
endpoint: storybook