static-web-apps-cli icon indicating copy to clipboard operation
static-web-apps-cli copied to clipboard

Get deployment url after successful deploy

Open tobiasdiez opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. Since the Azure/static-web-apps-deploy action is a container action and thus doesn't work in windows workflows, I've implemented the deployment to azure using this cli. In this setting, it would be nice to get the url where the site is deployed from swa deploy to e.g show it as a comment or start api tests.

Describe the solution you'd like swa deploy should return the deployment url (if deployment is successful). For additional convince, it would be nice if swa deploy would print the deployment url as a job output ::set-output deployment_url=<url> if the ci env variable is present.

Describe alternatives you've considered Manual scraping of the output.

tobiasdiez avatar Sep 17 '22 15:09 tobiasdiez

The following powershell script provides a workaround:

          $output = swa deploy <....> --verbose=silly 2>&1 | Out-String
          Write-Host $output
          $match = $output | Select-String -Pattern 'Project deployed to (?<url>.*) '
          if ($match -eq $null) { exit 1 }
          $url = $match.Matches[0].Groups['url'].Value
          echo "url=$url" >> $env:GITHUB_OUTPUT

tobiasdiez avatar May 20 '23 16:05 tobiasdiez