Skip to content

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

Merged
Maximo-Guk merged 1 commit intocloudflare:mainfrom
Ambroos:add-pages-deployment-alias
Oct 1, 2024
Merged

Add deployment-alias-url for pages deployments with Wrangler 3.78.0+#291
Maximo-Guk merged 1 commit intocloudflare:mainfrom
Ambroos:add-pages-deployment-alias

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
@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