Skip to content
Open
Show file tree
Hide file tree
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
7 changes: 3 additions & 4 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ name: 'Chromatic'

on:
pull_request:
branches: [ "main" ]
branches: ['main']
types: [opened, synchronize, reopened, closed, ready_for_review]
push:
branches: [ "main" ]
branches: ['main']

workflow_dispatch:

env:
FIGMA_TOKEN: ${{ secrets.FIGMA_AUTH_TOKEN }}
FONT_AWESOME_AUTH_TOKEN: ${{ secrets.FONT_AWESOME_AUTH_TOKEN }}
TOKENS_STUDIO_API_KEY: ${{ secrets.TOKENS_STUDIO_2_API_KEY }}

Expand All @@ -24,7 +23,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 22
node-version: 24
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ name: CI

on:
push:
branches: [ "main" ]
branches: ['main']
pull_request:
branches: [ "main" ]
branches: ['main']

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
FIGMA_TOKEN: ${{ secrets.FIGMA_AUTH_TOKEN }}
FONT_AWESOME_AUTH_TOKEN: ${{ secrets.FONT_AWESOME_AUTH_TOKEN }}
HUSKY: 0
TOKENS_STUDIO_API_KEY: ${{ secrets.TOKENS_STUDIO_2_API_KEY }}
Expand All @@ -21,13 +19,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22
node-version: 24
cache: 'yarn'

# Set up GitHub Actions caching for Wireit.
- uses: google/wireit@setup-github-actions-caching/v2

- run: yarn install --immutable

- run: yarn build

- run: yarn test
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- main

env:
FIGMA_TOKEN: ${{ secrets.FIGMA_AUTH_TOKEN }}
FONT_AWESOME_AUTH_TOKEN: ${{ secrets.FONT_AWESOME_AUTH_TOKEN }}
HUSKY: 0
TOKENS_STUDIO_API_KEY: ${{ secrets.TOKENS_STUDIO_2_API_KEY }}
Expand All @@ -30,7 +29,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: 22
node-version: 24
cache: 'yarn'
registry-url: 'https://npm.pkg.github.com'
scope: '@sl-design-system'
Expand Down
106 changes: 87 additions & 19 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ on:
workflow_dispatch:

env:
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
FONT_AWESOME_AUTH_TOKEN: ${{ secrets.FONT_AWESOME_AUTH_TOKEN }}
FIGMA_TOKEN: ${{ secrets.FIGMA_AUTH_TOKEN }}
HUSKY: 0
TOKENS_STUDIO_API_KEY: ${{ secrets.TOKENS_STUDIO_2_API_KEY }}

Expand All @@ -35,50 +33,120 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: 22
node-version: 24
cache: 'yarn'

# Set up GitHub Actions caching for Wireit.
- uses: google/wireit@setup-github-actions-caching/v2

- run: yarn install --immutable

- run: yarn storybook

- uses: azure/static-web-apps-deploy@v1
id: deploy
- uses: aws-actions/configure-aws-credentials@v6
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
action: upload
app_location: dist
production_branch: main
skip_api_build: true
skip_app_build: true
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
Comment thread
jpzwarte marked this conversation as resolved.
Comment thread
jpzwarte marked this conversation as resolved.

- name: Set branch name
id: branch
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "name=storybook-${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"
else
echo "name=main" >> "$GITHUB_OUTPUT"
fi

- name: Ensure Amplify branch exists
if: github.event_name == 'pull_request'
run: |
if aws amplify get-branch \
--app-id "${{ secrets.AWS_AMPLIFY_APP_ID }}" \
--branch-name "${{ steps.branch.outputs.name }}" >/dev/null 2>&1; then
echo "Amplify branch '${{ steps.branch.outputs.name }}' already exists."
else
aws amplify create-branch \
--app-id "${{ secrets.AWS_AMPLIFY_APP_ID }}" \
--branch-name "${{ steps.branch.outputs.name }}"
fi

- name: Deploy to AWS Amplify
id: deploy
run: |
DEPLOYMENT=$(aws amplify create-deployment \
--app-id "${{ secrets.AWS_AMPLIFY_APP_ID }}" \
--branch-name "${{ steps.branch.outputs.name }}" \
--output json)

JOB_ID=$(echo "$DEPLOYMENT" | jq -r '.jobId')
ZIP_URL=$(echo "$DEPLOYMENT" | jq -r '.zipUploadUrl')

cd dist && zip -qr ../deployment.zip . && cd ..
curl -sSf -T deployment.zip "$ZIP_URL"

aws amplify start-deployment \
--app-id "${{ secrets.AWS_AMPLIFY_APP_ID }}" \
--branch-name "${{ steps.branch.outputs.name }}" \
--job-id "$JOB_ID"

DEFAULT_DOMAIN=$(aws amplify get-app \
--app-id "${{ secrets.AWS_AMPLIFY_APP_ID }}" \
--query 'app.defaultDomain' \
--output text)
echo "preview_url=https://${{ steps.branch.outputs.name }}.${DEFAULT_DOMAIN}" >> "$GITHUB_OUTPUT"
Comment thread
jpzwarte marked this conversation as resolved.
Comment thread
jpzwarte marked this conversation as resolved.
Comment thread
jpzwarte marked this conversation as resolved.

- if: github.event_name == 'pull_request'
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Storybook preview
body-includes: '### 🕸 Preview deploys'

- if: github.event_name == 'pull_request'
name: Build comment body
id: comment
env:
EXISTING_BODY: ${{ steps.fc.outputs.comment-body }}
PREVIEW_URL: ${{ steps.deploy.outputs.preview_url }}
run: |
BODY="### 🕸 Preview deploys"
BODY="$BODY
- **Storybook:** $PREVIEW_URL"

WEBSITE_LINE=$(echo "$EXISTING_BODY" | grep '^- \*\*Website:\*\*' || true)
if [ -n "$WEBSITE_LINE" ]; then
BODY="$BODY
$WEBSITE_LINE"
Comment thread
jpzwarte marked this conversation as resolved.
fi

{
echo "body<<EOF"
echo "$BODY"
echo "EOF"
} >> "$GITHUB_OUTPUT"

- if: github.event_name == 'pull_request'
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
### 🕸 Storybook preview
You can view a preview [here](${{ steps.deploy.outputs.static_web_app_url }}) (commit [`${{ github.event.pull_request.head.sha }}`](https://github.com/sl-design-system/components/commit/${{ github.event.pull_request.head.sha }})).
body: ${{ steps.comment.outputs.body }}
edit-mode: replace

cleanup:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Cleanup
steps:
- uses: azure/static-web-apps-deploy@v1
- uses: aws-actions/configure-aws-credentials@v6
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
action: close
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
Comment thread
jpzwarte marked this conversation as resolved.

- name: Delete PR branch from Amplify
run: |
aws amplify delete-branch \
--app-id "${{ secrets.AWS_AMPLIFY_APP_ID }}" \
--branch-name "storybook-${{ github.event.pull_request.number }}"
Loading
Loading