diff --git a/.github/workflows/check-storefront.yml b/.github/workflows/check-storefront.yml index 6dedb8f088..3d3a3f2fc8 100644 --- a/.github/workflows/check-storefront.yml +++ b/.github/workflows/check-storefront.yml @@ -1,15 +1,10 @@ -# Runs conventional commit check on PR -name: Checks storefront +name: Checks Storefront on: workflow_dispatch: pull_request: - branches: - - main paths: - 'apps/storefront/**' push: - branches: - - main paths: - 'apps/storefront/**' jobs: diff --git a/.github/workflows/checks-packages.yml b/.github/workflows/checks-packages.yml index a45d9f6212..816cd531a0 100644 --- a/.github/workflows/checks-packages.yml +++ b/.github/workflows/checks-packages.yml @@ -1,16 +1,11 @@ -# Runs conventional commit check on PR -name: Checks packages +name: Checks Packages on: workflow_dispatch: pull_request: - branches: - - main paths: - 'packages/**' - '*.*js' push: - branches: - - main paths: - 'packages/**' jobs: diff --git a/.github/workflows/conventional-pr.yml b/.github/workflows/conventional-pr.yml index 1474642de4..3e05cfec6c 100644 --- a/.github/workflows/conventional-pr.yml +++ b/.github/workflows/conventional-pr.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - main + - next types: - opened - edited diff --git a/.github/workflows/development-deploy.yml b/.github/workflows/deploy-dev.yml similarity index 96% rename from .github/workflows/development-deploy.yml rename to .github/workflows/deploy-dev.yml index 68bb23468a..abdf982716 100644 --- a/.github/workflows/development-deploy.yml +++ b/.github/workflows/deploy-dev.yml @@ -1,4 +1,4 @@ -name: Deploy Development Production +name: Deploy Development env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_DEVELOPMENT }} @@ -7,6 +7,7 @@ on: push: branches: - main + - next paths: - 'apps/dev/**' jobs: diff --git a/.github/workflows/deploy-storefront.yml b/.github/workflows/deploy-storefront.yml new file mode 100644 index 0000000000..876bb5e843 --- /dev/null +++ b/.github/workflows/deploy-storefront.yml @@ -0,0 +1,59 @@ +name: Deploy Storefront +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_STOREFRONT }} +on: + workflow_dispatch: + inputs: + environment: + type: choice + default: next + description: Deploy to environment + options: + - production + - next + push: + branches: + - next + paths: + - 'apps/storefront/**' +jobs: + Deploy-Production: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Use node 20 and yarn cache + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build + run: yarn build + + - name: Install Vercel CLI + run: yarn add vercel@latest + + - name: Set default environment value if push event is triggered + id: defaultenvironment + run: | + ENVIRONMENT=${{ github.event.inputs.environment }} + echo "value=${ENVIRONMENT:-"next"}" >> "$GITHUB_OUTPUT" + + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=${{(steps.defaultenvironment.outputs.value == 'next' && 'preview') || 'production'}} --token=${{ secrets.VERCEL_TOKEN }} + + - name: Build Project Artifacts + run: vercel build ${{(steps.defaultenvironment.outputs.value == 'production' && '--prod') || ''}} --token=${{ secrets.VERCEL_TOKEN }} + + - id: deploy + name: Deploy Project Artifacts to Vercel + run: echo "url=$(vercel deploy --prebuilt ${{(steps.defaultenvironment.outputs.value == 'production' && '--prod') || ''}} --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_OUTPUT + + - name: Set Vercel alias + run: vercel alias --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_TEAM }} set ${{ steps.deploy.outputs.url }} next.designsystemet.no + if: steps.defaultenvironment.outputs.value == 'next' diff --git a/.github/workflows/storybook-deploy-vercel.yml b/.github/workflows/deploy-storybook.yml similarity index 98% rename from .github/workflows/storybook-deploy-vercel.yml rename to .github/workflows/deploy-storybook.yml index 1e8d77043d..e4af7eaac7 100644 --- a/.github/workflows/storybook-deploy-vercel.yml +++ b/.github/workflows/deploy-storybook.yml @@ -8,6 +8,7 @@ on: inputs: environment: type: choice + default: next description: Deploy to environment options: - production diff --git a/.github/workflows/deploy-theme.yml b/.github/workflows/deploy-theme.yml new file mode 100644 index 0000000000..bdbb8e00ac --- /dev/null +++ b/.github/workflows/deploy-theme.yml @@ -0,0 +1,63 @@ +name: Deploy Theme +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_THEME }} +on: + workflow_dispatch: + inputs: + environment: + type: choice + default: next + description: Deploy to environment + options: + - production + - next + pull_request: + types: [opened, synchronize] + paths: + - 'apps/theme/**' + push: + branches: + - next + paths: + - 'apps/theme/**' +jobs: + Deploy-Production: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Use node 20 and yarn cache + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build + run: yarn build + + - name: Install Vercel CLI + run: yarn add vercel@latest + + - name: Set default environment value if push event is triggered + id: defaultenvironment + run: | + ENVIRONMENT=${{ github.event.inputs.environment }} + echo "value=${ENVIRONMENT:-"next"}" >> "$GITHUB_OUTPUT" + + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=${{(steps.defaultenvironment.outputs.value == 'next' && 'preview') || 'production'}} --token=${{ secrets.VERCEL_TOKEN }} + + - name: Build Project Artifacts + run: vercel build ${{(steps.defaultenvironment.outputs.value == 'production' && '--prod') || ''}} --token=${{ secrets.VERCEL_TOKEN }} + + - id: deploy + name: Deploy Project Artifacts to Vercel + run: echo "url=$(vercel deploy --prebuilt ${{(steps.defaultenvironment.outputs.value == 'production' && '--prod') || ''}} --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_OUTPUT + + - name: Set Vercel alias + run: vercel alias --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_TEAM }} set ${{ steps.deploy.outputs.url }} next.theme.designsystemet.no + if: steps.defaultenvironment.outputs.value == 'next' diff --git a/.github/workflows/storefront-preview.yml b/.github/workflows/preview-storefront.yml similarity index 98% rename from .github/workflows/storefront-preview.yml rename to .github/workflows/preview-storefront.yml index 8602a8c8df..6cc72b6b5b 100644 --- a/.github/workflows/storefront-preview.yml +++ b/.github/workflows/preview-storefront.yml @@ -1,4 +1,4 @@ -name: Deploy Storefront Preview +name: Deploy Storefront PR env: VERCEL_TEAM: ${{ secrets.VERCEL_TEAM }} VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} diff --git a/.github/workflows/storybook-preview.yml b/.github/workflows/preview-storybook.yml similarity index 98% rename from .github/workflows/storybook-preview.yml rename to .github/workflows/preview-storybook.yml index c7e766f955..db5970f21c 100644 --- a/.github/workflows/storybook-preview.yml +++ b/.github/workflows/preview-storybook.yml @@ -1,4 +1,4 @@ -name: Deploy Storybook PR Preview +name: Deploy Storybook PR env: VERCEL_TEAM: ${{ secrets.VERCEL_TEAM }} VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} diff --git a/.github/workflows/storefront-deploy.yml b/.github/workflows/storefront-deploy.yml deleted file mode 100644 index 83a7d73e50..0000000000 --- a/.github/workflows/storefront-deploy.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Deploy Storefront Production -env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_STOREFRONT }} -on: - push: - branches: - - main - paths: - - 'apps/storefront/**' -jobs: - Deploy-Production: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Use node 20 and yarn cache - uses: actions/setup-node@v4 - with: - node-version: '20' - cache: 'yarn' - - - name: Install dependencies - run: yarn install --frozen-lockfile - - - name: Build - run: yarn build - - - name: Install Vercel CLI - run: yarn add vercel@latest - - - name: Pull Vercel Environment Information - run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} - - - name: Build Project Artifacts - run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} - - - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} diff --git a/.github/workflows/theme-deploy.yml b/.github/workflows/theme-deploy.yml deleted file mode 100644 index 19c407cd2a..0000000000 --- a/.github/workflows/theme-deploy.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Deploy Theme Production -env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_THEME }} -on: - workflow_dispatch: - pull_request: - types: [opened, synchronize] - paths: - - 'apps/theme/**' -jobs: - Deploy-Production: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Use node 20 and yarn cache - uses: actions/setup-node@v4 - with: - node-version: '20' - cache: 'yarn' - - - name: Install dependencies - run: yarn install --frozen-lockfile - - - name: Build - run: yarn build - - - name: Install Vercel CLI - run: yarn add vercel@latest - - - name: Pull Vercel Environment Information - run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} - - - name: Build Project Artifacts - run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} - - - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} diff --git a/apps/storefront/components/ImageBanner/ImageBanner.tsx b/apps/storefront/components/ImageBanner/ImageBanner.tsx index 9957838b4a..fb66ef7b92 100644 --- a/apps/storefront/components/ImageBanner/ImageBanner.tsx +++ b/apps/storefront/components/ImageBanner/ImageBanner.tsx @@ -1,5 +1,6 @@ /* eslint-disable @next/next/no-img-element */ import type React from 'react'; +import type { ButtonProps } from '@digdir/designsystemet-react'; import { useEffect, useState, createElement } from 'react'; import cn from 'clsx'; import { Link, Button } from '@digdir/designsystemet-react'; @@ -33,6 +34,8 @@ type ImageSectionButtonProps = { text: string; prefix?: React.ReactNode; href: string; + variant?: ButtonProps['variant']; + color?: ButtonProps['color']; }; const ImageBanner = ({ @@ -126,7 +129,8 @@ const ImageBanner = ({