diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index fe9318d3c..231c4c8fd 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -80,12 +80,14 @@ jobs: stage-app: uses: ./.github/workflows/stage-vercel-deployment.yml with: + target_environment: production vercel_project_id_var: VERCEL_PROJECT_ID_APP secrets: inherit stage-global-app: uses: ./.github/workflows/stage-vercel-deployment.yml with: + target_environment: production vercel_project_id_var: VERCEL_PROJECT_ID_GLOBAL_APP secrets: inherit diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml new file mode 100644 index 000000000..3df51f73c --- /dev/null +++ b/.github/workflows/deploy-staging.yml @@ -0,0 +1,26 @@ +name: Deploy Web to Staging + +on: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: deploy-staging + cancel-in-progress: false + +jobs: + deploy-app: + uses: ./.github/workflows/stage-vercel-deployment.yml + with: + target_environment: staging + vercel_project_id_var: VERCEL_PROJECT_ID_APP + secrets: inherit + + deploy-global-app: + uses: ./.github/workflows/stage-vercel-deployment.yml + with: + target_environment: staging + vercel_project_id_var: VERCEL_PROJECT_ID_GLOBAL_APP + secrets: inherit diff --git a/.github/workflows/redeploy-web.yml b/.github/workflows/redeploy-web.yml index 34f1a809f..2f7893626 100644 --- a/.github/workflows/redeploy-web.yml +++ b/.github/workflows/redeploy-web.yml @@ -27,6 +27,7 @@ jobs: needs: verify-main uses: ./.github/workflows/stage-vercel-deployment.yml with: + target_environment: production vercel_project_id_var: VERCEL_PROJECT_ID_APP secrets: inherit @@ -34,6 +35,7 @@ jobs: needs: verify-main uses: ./.github/workflows/stage-vercel-deployment.yml with: + target_environment: production vercel_project_id_var: VERCEL_PROJECT_ID_GLOBAL_APP secrets: inherit diff --git a/.github/workflows/stage-vercel-deployment.yml b/.github/workflows/stage-vercel-deployment.yml index 053e8d1bf..e12ec9aba 100644 --- a/.github/workflows/stage-vercel-deployment.yml +++ b/.github/workflows/stage-vercel-deployment.yml @@ -3,6 +3,10 @@ name: Stage Vercel Deployment on: workflow_call: inputs: + target_environment: + description: 'GitHub and Vercel environment to deploy to' + required: true + type: string vercel_project_id_var: description: 'Name of the GitHub variable containing the Vercel project ID to deploy' required: true @@ -19,12 +23,13 @@ jobs: stage: runs-on: ${{ vars.RUNNER_DEFAULT_LABEL || 'ubuntu-latest' }} timeout-minutes: 30 - environment: production + environment: ${{ inputs.target_environment }} outputs: deployment_url: ${{ steps.deploy.outputs.deployment_url }} env: + TARGET_ENVIRONMENT: ${{ inputs.target_environment }} VERCEL_VERSION: '53.3.1' VERCEL_ORG_ID: ${{ vars.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ vars[inputs.vercel_project_id_var] }} @@ -41,7 +46,12 @@ jobs: - name: Stage Vercel deployment id: deploy run: | - deployment_output=$(vercel deploy --prod --skip-domain --token=${{ secrets.VERCEL_TOKEN }}) + if [ "$TARGET_ENVIRONMENT" = "production" ]; then + deployment_output=$(vercel deploy --prod --skip-domain --token=${{ secrets.VERCEL_TOKEN }}) + else + deployment_output=$(vercel deploy --target="$TARGET_ENVIRONMENT" --token=${{ secrets.VERCEL_TOKEN }}) + fi + deployment_url=$(printf '%s\n' "$deployment_output" | tail -n 1) if [[ ! "$deployment_url" =~ ^https:// ]]; then echo "Vercel deploy did not print a deployment URL" >&2