diff --git a/.github/actions/vercel/action.yaml b/.github/actions/vercel/action.yaml index 20077162acd1..b0582dfee716 100644 --- a/.github/actions/vercel/action.yaml +++ b/.github/actions/vercel/action.yaml @@ -76,7 +76,11 @@ runs: export GITHUB_SHA=${{ inputs.sha }} export GITHUB_REF_NAME=${{ inputs.ref-name }} - pnpx vercel build + if [ "${{ inputs.environment }}" = "production" ]; then + pnpx vercel build --prod + else + pnpx vercel build + fi shell: bash - name: Patch @@ -103,10 +107,19 @@ runs: - name: Deploy id: deploy run: | - pnpx vercel deploy \ - --prebuilt \ - --token ${{ inputs.vercel-token }} \ - 2> >(tee info.txt >&2) | tee domain.txt + if [ "${{ inputs.environment }}" = "production" ]; then + pnpx vercel deploy \ + --prebuilt \ + --prod \ + --skip-domain \ + --token ${{ inputs.vercel-token }} \ + 2> >(tee info.txt >&2) | tee domain.txt + else + pnpx vercel deploy \ + --prebuilt \ + --token ${{ inputs.vercel-token }} \ + 2> >(tee info.txt >&2) | tee domain.txt + fi echo "domain=$(cat ./domain.txt)" >> $GITHUB_OUTPUT echo "inspect-url=$(cat info.txt | grep 'Inspect:' | awk '{print $2}')" >> $GITHUB_OUTPUT @@ -114,6 +127,7 @@ runs: shell: bash - name: Set Alias + if: ${{ inputs.environment != 'production' }} id: alias run: | ALIAS="${{ steps.branch.outputs.value }}" diff --git a/.github/workflows/vercel-deploy-staging.yml b/.github/workflows/vercel-deploy-staging.yml index a96527e72bfb..51e6d23bf227 100644 --- a/.github/workflows/vercel-deploy-staging.yml +++ b/.github/workflows/vercel-deploy-staging.yml @@ -87,6 +87,18 @@ jobs: sha: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} environment: ${{ matrix.environment }} + - uses: ./.github/actions/vercel + if: matrix.environment == 'staging' + id: vercel-prod + name: Deploy to Vercel + with: + vercel-token: ${{ secrets.VERCEL_TOKEN }} + vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} + vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} + ref-name: ${{ github.ref_name }} + sha: ${{ github.sha }} + environment: "production" + - name: Debug Vercel Outputs run: | echo "domain=${{ steps.vercel.outputs.domain }}" @@ -99,6 +111,13 @@ jobs: description: "[${{ matrix.environment }}] Vercel logs" url: "${{ steps.vercel.outputs.inspect-url }}" + - uses: ./.github/actions/add-status + if: matrix.environment == 'staging' + with: + title: "⏰ [${{ matrix.environment }}] Vercel Production Inspection" + description: "[${{ matrix.environment }}] Vercel production logs" + url: "${{ steps.vercel-prod.outputs.inspect-url }}" + - uses: ./.github/actions/add-status with: title: "⭐ [${{ matrix.environment }}] Apps Webstudio URL"