Deploy Theme #503
Workflow file for this run
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: 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 | |
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: npm install --global vercel@latest | |
- name: Set Vercel environment | |
id: environment | |
run: | | |
ENVIRONMENT=${{ github.event.inputs.environment == 'production' && 'production' || 'preview' }} | |
echo "vercel=${ENVIRONMENT}" >> "$GITHUB_OUTPUT" | |
- name: Pull Vercel Environment Information | |
run: vercel pull --yes --environment=${{steps.environment.outputs.vercel}} --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Build Project Artifacts | |
run: vercel build ${{(steps.environment.outputs.vercel == 'production' && '--prod') || ''}} --token=${{ secrets.VERCEL_TOKEN }} | |
- id: deploy | |
name: Deploy Project Artifacts to Vercel | |
run: echo "url=$(vercel deploy --prebuilt ${{(steps.environment.outputs.vercel == 'production' && '--prod') || ''}} --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_OUTPUT | |
- name: Set Vercel alias | |
if: steps.environment.outputs.vercel == 'preview' | |
run: vercel alias --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_TEAM }} set ${{ steps.deploy.outputs.url }} next.theme.designsystemet.no |