File tree 2 files changed +8
-8
lines changed
2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -64,22 +64,22 @@ jobs:
64
64
env :
65
65
META_TAG : ${{ steps.hash_branch.outputs.digest }}-${{ github.run_number }}-${{ github.run_attempt}}
66
66
run : |
67
+ set -e
67
68
vercel pull --yes --environment=preview --token=${VERCEL_TOKEN}
68
69
vercel build --token=${VERCEL_TOKEN}
69
70
vercel deploy --prebuilt --archive=tgz --token=${VERCEL_TOKEN} --meta base_hash=${{ env.META_TAG }}
70
71
71
- vercel ls --token=${VERCEL_TOKEN} --meta base_hash=${{ env.META_TAG }} &> vercel-output
72
- DEFAULT_URL=$(cat vercel-output | grep http | awk '{print $2}')
72
+ DEFAULT_URL=$( vercel ls --token=${VERCEL_TOKEN} --meta base_hash=${{ env.META_TAG }})
73
+ echo "preview URL:${DEFAULT_URL} , alias URL:${{ steps.set_env.outputs.VERCEL_ALIAS_DOMAIN }}"
73
74
ALIAS_URL=$(vercel alias set ${DEFAULT_URL} ${{ steps.set_env.outputs.VERCEL_ALIAS_DOMAIN }} --token=${VERCEL_TOKEN} --scope ${VERCEL_TEAM}| awk '{print $3}')
74
75
75
76
echo "New preview URL: ${DEFAULT_URL}"
76
77
echo "New alias URL: ${ALIAS_URL}"
77
- echo "META_TAG=${META_TAG}"
78
78
echo "VERCEL_URL=${ALIAS_URL}" >> "$GITHUB_OUTPUT"
79
79
80
80
- uses : mshick/add-pr-comment@v2
81
81
with :
82
82
message : |
83
83
Your build has completed!
84
84
85
- [Preview deployment](${{ steps.vercel.outputs.VERCEL_URL }})
85
+ [Preview deployment](${{ steps.vercel.outputs.VERCEL_URL }})
Original file line number Diff line number Diff line change @@ -7,11 +7,11 @@ GET_DEPLOYMENTS_ENDPOINT="https://api.vercel.com/v6/deployments"
7
7
DELETE_DEPLOYMENTS_ENDPOINT=" https://api.vercel.com/v13/deployments"
8
8
9
9
# Create a list of deployments.
10
- # deployments=$(curl -s -X GET "$GET_DEPLOYMENTS_ENDPOINT/?projectId=$VERCEL_PROJECT_ID&teamId=$VERCEL_ORG_ID" -H "Authorization: Bearer $VERCEL_TOKEN ")
11
- deployments=$( curl -s -X GET " $GET_DEPLOYMENTS_ENDPOINT /?projectId=$VERCEL_PROJECT_ID " -H " Authorization: Bearer $VERCEL_TOKEN " )
10
+ deployments=$( curl -s -X GET " $GET_DEPLOYMENTS_ENDPOINT /?projectId=$VERCEL_PROJECT_ID &teamId=$VERCEL_ORG_ID " -H " Authorization: Bearer $VERCEL_TOKEN " )
11
+ # deployments=$(curl -s -X GET "$GET_DEPLOYMENTS_ENDPOINT/?projectId=$VERCEL_PROJECT_ID" -H "Authorization: Bearer $VERCEL_TOKEN ")
12
12
13
13
# Filter the deployments list by meta.base_hash === meta tag.
14
- filtered_deployments=$( echo $deployments | jq --arg META_TAG " $META_TAG " ' [.deployments[] | select(.meta.base_hash | type == "string" and contains($META_TAG)) | .uid] | join(",")' )
14
+ filtered_deployments=$( echo -E $deployments | jq --arg META_TAG " $META_TAG " ' [.deployments[] | select(.meta.base_hash | type == "string" and contains($META_TAG)) | .uid] | join(",")' )
15
15
filtered_deployments=" ${filtered_deployments// \" / } " # Remove double quotes
16
16
17
17
# Clears the values from filtered_deployments
@@ -24,7 +24,7 @@ echo "Filtered deployments ${filtered_deployments}"
24
24
for uid in " ${values[@]} " ; do
25
25
echo " Deleting ${uid} "
26
26
27
- delete_url=${DELETE_DEPLOYMENTS_ENDPOINT} /${uid}
27
+ delete_url=" ${DELETE_DEPLOYMENTS_ENDPOINT} /${uid} ?teamId= ${VERCEL_ORG_ID} "
28
28
echo $delete_url
29
29
30
30
# Make DELETE a request to the /v13/deployments/{id} endpoint.
You can’t perform that action at this time.
0 commit comments