Browse Source

refactor: Use env variables for Vercel commands

David Höck 9 months ago
parent
commit
fadc1be72d
1 changed files with 6 additions and 4 deletions
  1. 6 4
      .github/workflows/deploy_dashboard.yml

+ 6 - 4
.github/workflows/deploy_dashboard.yml

@@ -10,6 +10,8 @@ on:
 env:
 env:
     NEXT_TELEMETRY_DISABLED: 1
     NEXT_TELEMETRY_DISABLED: 1
     NODE_OPTIONS: '--max_old_space_size=4096'
     NODE_OPTIONS: '--max_old_space_size=4096'
+    VERCEL_PROJECT: admin-dashboard
+    VERCEL_SCOPE: vendure
 
 
 jobs:
 jobs:
     deploy:
     deploy:
@@ -36,17 +38,17 @@ jobs:
               run: npm run build:core-common
               run: npm run build:core-common
 
 
             - name: Link folder to project
             - name: Link folder to project
-              run: vercel link --yes --scope vendure --project=admin-dashboard --token=${{ secrets.VERCEL_TOKEN }}
+              run: vercel link --yes --scope ${{ env.VERCEL_SCOPE }} --project=${{ env.VERCEL_PROJECT }} --token=${{ secrets.VERCEL_TOKEN }}
 
 
             - name: Pull Vercel Environment Information
             - name: Pull Vercel Environment Information
-              run: vercel pull --environment=${{ env.VERCEL_ENV }} --yes --scope vendure --token=${{ secrets.VERCEL_TOKEN }}
+              run: vercel pull --environment=${{ env.VERCEL_ENV }} --yes --scope ${{ env.VERCEL_SCOPE }} --token=${{ secrets.VERCEL_TOKEN }}
 
 
             - name: Build Project Artifacts
             - name: Build Project Artifacts
-              run: vercel build --scope vendure --token=${{ secrets.VERCEL_TOKEN }} ${{ env.VERCEL_ENV == 'production' && '--prod' || '' }}
+              run: vercel build --scope ${{ env.VERCEL_SCOPE }} --token=${{ secrets.VERCEL_TOKEN }} ${{ env.VERCEL_ENV == 'production' && '--prod' || '' }}
 
 
             - name: Deploy Project Artifacts to Vercel
             - name: Deploy Project Artifacts to Vercel
               id: deploy_vercel
               id: deploy_vercel
-              run: vercel deploy --archive=tgz --prebuilt --scope vendure  ${{ env.VERCEL_ENV == 'production' && '--prod' || '' }} --token=${{ secrets.VERCEL_TOKEN }} | awk 'END{print}' | awk '{print "URL="$1}' >> $GITHUB_OUTPUT
+              run: vercel deploy --archive=tgz --prebuilt --scope ${{ env.VERCEL_SCOPE }}  ${{ env.VERCEL_ENV == 'production' && '--prod' || '' }} --token=${{ secrets.VERCEL_TOKEN }} | awk 'END{print}' | awk '{print "URL="$1}' >> $GITHUB_OUTPUT
 
 
             - name: Print Vercel URL
             - name: Print Vercel URL
               shell: bash
               shell: bash