feat: add PR preview deployments via Azure Static Web Apps#65
Merged
Conversation
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-65.eastus2.2.azurestaticapps.net |
Closes #64 - Add apiBaseUrlInterceptor: prepends apiBaseUrl to /api/* requests, allowing the Angular app to call the production backend from a different origin in preview builds - Add environment files: environment.ts (empty = same-origin, used in dev and prod) and environment.preview.ts (production App Service URL) - Add preview build configuration in project.json with fileReplacements to swap in environment.preview.ts - Add staticwebapp.config.json for SPA fallback routing in Azure SWA - Add CORS policy in Program.cs allowing *.azurestaticapps.net origins - Add preview.yml workflow: builds Angular with the preview config, deploys to Azure SWA on PR open/sync, closes staging env on PR close Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d00d543 to
8e22b81
Compare
Captures static_web_app_url output from the deploy step and posts it as a comment on the PR. Updates the existing comment on re-deploys rather than adding a new one each time. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-65.eastus2.2.azurestaticapps.net |
|
🔍 Preview deployment: https://green-water-08792290f-65.eastus2.2.azurestaticapps.net |
Azure/static-web-apps-deploy already posts a PR comment when repo_token is provided. Remove the redundant actions/github-script step. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-65.eastus2.2.azurestaticapps.net |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #64
What
Adds automatic preview deployments for every PR using Azure Static Web Apps (free tier), so UI changes can be reviewed without running the app locally.
How it works
environment.preview.ts(viafileReplacements) which setsapiBaseUrlto the production App Service URLapiBaseUrlInterceptorprepends that URL to all/api/*requests, so the preview SPA can reach the production backend from a different originProgram.csto allow any*.azurestaticapps.netoriginpreview.ymlGitHub Actions workflow: builds with--configuration preview, copiesstaticwebapp.config.jsonfor SPA routing, deploys to Azure SWA; closes the staging environment when the PR is closedstaticwebapp.config.jsonconfigures SPA fallback routing so Angular's router works correctly on direct URL accessAzure setup completed
angular-cli-netcore-ngrx-startercreated (free tier, East US 2)AZURE_STATIC_WEB_APPS_API_TOKENsecret added to the repositoryNotes
.NETbuild in the preview pipeline → much faster CIci.ymlworkflow still runs in parallel for lint/test/build checks