Skip to content

Commit 43467b4

Browse files
committed
Update demo deployment for unique url
1 parent 42e0a1e commit 43467b4

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

.github/actions/netlify-deploy/action.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ outputs:
1919
netlify_url:
2020
description: The deployed URL
2121
value: ${{ steps.deploy.outputs.netlify_url }}
22+
unique_deploy_url:
23+
description: The unique hash-based deployment URL for this specific build
24+
value: ${{ steps.deploy.outputs.unique_deploy_url }}
2225

2326
runs:
2427
using: composite
@@ -32,9 +35,18 @@ runs:
3235
NETLIFY_AUTH_TOKEN: ${{ inputs.auth-token }}
3336
NETLIFY_SITE_ID: ${{ inputs.site-id }}
3437
run: |
38+
# Execute the deployment
3539
if [ -n "$ALIAS" ]; then
3640
npx -y netlify-cli deploy --dir="$DIR" --alias "$ALIAS" --json > deploy_output.json
3741
else
3842
npx -y netlify-cli deploy --dir="$DIR" --prod --json > deploy_output.json
3943
fi
40-
echo "netlify_url=$(jq -r '.url // .deploy_url' deploy_output.json)" >> "$GITHUB_OUTPUT"
44+
45+
# Collect the urls from the deployment output
46+
NETLIFY_URL=$(jq -r '.url // .deploy_url' deploy_output.json)
47+
SITE_NAME=$(jq -r '.site_name' deploy_output.json)
48+
DEPLOY_ID=$(jq -r '.deploy_id' deploy_output.json)
49+
UNIQUE_URL="https://${DEPLOY_ID}--${SITE_NAME}.netlify.app"
50+
51+
echo "netlify_url=$NETLIFY_URL" >> "$GITHUB_OUTPUT"
52+
echo "unique_deploy_url=$UNIQUE_URL" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)