Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deployment-alias-url for pages deployments with Wrangler 3.78.0+ #291

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

Ambroos
Copy link
Contributor

@Ambroos Ambroos commented Sep 19, 2024

Since the lovely PR cloudflare/workers-sdk#6643 that landed in Wrangler 3.78.0 it's now possible to get the deployment alias from the pages deploy output too.

This PR exposes that in a backwards compatible way. When there is no alias (or on older Wrangler versions) it'll just not be set.

I tested this in our local repo on commit Ambroos@6dcec67 (which contains dist) but is otherwise identical to this PR, and things seem very functional. Output below:

Run Ambroos/wrangler-action@6dcec6789d82c53bb800db578877e56cc8[1](snip#step:13:1)c2c45
  with:
    wranglerVersion: 3.78.5
    apiToken: ***
    accountId: ***
    workingDirectory: packages/snip
    command: pages deploy "snip" --project-name=snip --branch="ci/use-real-cf-preview-branch-url" --commit-message="ci: use real CF preview branch url" --commit-hash="snip"
    quiet: false
  env:
    PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
🔍 Checking for existing Wrangler installation
  /opt/hostedtoolcache/node/20.17.0/x64/bin/npx --no-install wrangler --version 3.78.5
  ✅ Using Wrangler 3.78.5

🚀 Running Wrangler Commands
  /opt/hostedtoolcache/node/20.17.0/x6[4](snip#step:13:4)/bin/npx wrangler pages deploy style-guide/build --project-name=ui --branch=ci/use-real-cf-preview-branch-url --commit-message=ci: use real CF preview branch url --commit-hash=snip
  Uploading... (5/5)
  ✨ Success! Uploaded 0 files (5 already uploaded)
  🌎 Deploying...
  ✨ Deployment complete! Take a peek over at https://abcdef.snip.pages.dev
  ✨ Deployment alias URL: https://ci-use-real-cf-preview-branc.snip.pages.dev
🏁 Wrangler Action completed


Run echo "### Deployed preview to Cloudflare Pages" >> $GITHUB_STEP_SUMMARY
  echo "### Deployed preview to Cloudflare Pages" >> $GITHUB_STEP_SUMMARY
  echo "🌩️ Preview URL: https://abcdef.snip.pages.dev" >> $GITHUB_STEP_SUMMARY
  echo "🌳 Branch URL: https://ci-use-real-cf-preview-branc.snip.pages.dev" >> $GITHUB_STEP_SUMMARY

@eduardoborges
Copy link

Great work!

@Ambroos
Copy link
Contributor Author

Ambroos commented Sep 23, 2024

@Maximo-Guk Would you mind taking a peek? Thanks!

Copy link
Member

@Maximo-Guk Maximo-Guk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ambroos Great work, thank you!

@Maximo-Guk Maximo-Guk merged commit 7b9aec5 into cloudflare:main Oct 1, 2024
1 check passed
@github-actions github-actions bot mentioned this pull request Oct 1, 2024
@Ambroos Ambroos deleted the add-pages-deployment-alias branch October 1, 2024 22:34
@WalshyDev
Copy link
Member

Thank you @Ambroos :)

@ashkulz
Copy link

ashkulz commented Oct 2, 2024

@Maximo-Guk / @WalshyDev, can we have a new release which includes this, please? 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants