From b068c38b9986e460fad6bab28cace82055a1f6ba Mon Sep 17 00:00:00 2001 From: Konrad Jamrozik Date: Thu, 21 Dec 2023 15:48:45 -0800 Subject: [PATCH] Document in Technical.md: "How the API backend action workflow was created" --- docs/Technical.md | 54 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/docs/Technical.md b/docs/Technical.md index e781f646..54ee9406 100644 --- a/docs/Technical.md +++ b/docs/Technical.md @@ -2,17 +2,39 @@ ## How the API backend action workflow was created -The backend API deployment configuration is a GitHub Action workflow [.github/workflows/api-game-lib.yml](.github/workflows/api-game-lib.yml) -which was initially created (see [git history](https://github.com/konrad-jamrozik/game/commits/main/.github/workflows/api-game-lib.yml)) -by following these instructions: +The backend API deployment configuration is a GitHub Action workflow [.github/workflows/main_api-game-lib.yml](.github/workflows/main_api-game-lib.yml). +It uses the `AZUREAPPSERVICE_PUBLISHPROFILE_D5F222C936074008827578A5DCB17571` secret in the [GitHub actions secrets]. + +I have initially created it using [api-game-lib Deployment Center] per the [Continuous deployment to Azure App Service] +article. Once I clicked the relevant button in Azure portal, it has pushed +[this commit][commit with API GHAW from Depl Center]. +The file was not yet working correctly, though, and I had to fix it by making [this commit][commit with API GHAW fix]. + +Having the GitHub action workflow created from the deployment center shows that it is connected to GitHub, in `Settings` +pane in the [Deployment Center Azure view][api-game-lib Deployment Center]. There are also few other benefits, like +logs being synced from the GitHub runner logs to the center, as explained in [the FAQ][Azure App Service CD FAQ]. + +Note that previously I had another GitHub action workflow for deploying the API, the `api-game-lib.yml`. +Per [its history][api-game-lib.yml git history], at first I created it by following: + +- [Tutorial: Create a minimal API with ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/tutorials/min-web-api?view=aspnetcore-8.0&tabs=visual-studio), +to create the stub API. +- [Quickstart: Deploy an ASP.NET web app](https://learn.microsoft.com/en-us/azure/app-service/quickstart-dotnetcore?tabs=net70&pivots=development-environment-vs), +to deploy the API to Azure. -- [Tutorial: Create a minimal API with ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/tutorials/min-web-api?view=aspnetcore-8.0&tabs=visual-studio) -- [Quickstart: Deploy an ASP.NET web app](https://learn.microsoft.com/en-us/azure/app-service/quickstart-dotnetcore?tabs=net70&pivots=development-environment-vs) +However, it appears to be obsolete. I created it in August 2023, but I was unable to reproduce it in December 2023. +Overall, the story for creating GitHub actions workflow for ASP.NET Core .NET Web App is messy, as I documented here: + +- [The documentation about creating GitHub Actions workflow for CI/CD for .NET Core Azure Web App needs consolidation #118243](https://github.com/MicrosoftDocs/azure-docs/issues/118243). + +When deleting `api-game-lib.yml`, I also removed its secret from [GitHub actions secrets], `API_GAME_LIB_65C2`. ## How the web fronted GitHub action workflow was created -The frontend web deployment configuration is a GitHub action workflow [.github/workflows/azure-static-web-apps-zealous-sea-0ffc3931e.yml](.github/workflows/azure-static-web-apps-zealous-sea-0ffc3931e.yml) -which was initially created (see [git history](https://github.com/konrad-jamrozik/game/commits/main/.github/workflows/azure-static-web-apps-zealous-sea-0ffc3931e.yml)) +The frontend web deployment configuration is a GitHub action workflow [.github/workflows/azure-static-web-apps-zealous-sea-0ffc3931e.yml](.github/workflows/azure-static-web-apps-zealous-sea-0ffc3931e.yml). +It uses the `AZURE_STATIC_WEB_APPS_API_TOKEN_ZEALOUS_SEA_0FFC3931E` secret in the [GitHub actions secrets]. + +That workflow was initially created (see [git history](https://github.com/konrad-jamrozik/game/commits/main/.github/workflows/azure-static-web-apps-zealous-sea-0ffc3931e.yml)) by following these instructions: - [Vite / Deploying a Static Site / Azure Static Web Apps](https://vitejs.dev/guide/static-deploy.html#azure-static-web-apps) @@ -20,8 +42,22 @@ by following these instructions: Specifically, I used the [Azure Static Web Apps VS Code extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps) wizard to configure the deployment, per `Vite / Deploying a Static Site / Azure Static Web Apps`: -> Follow the wizard started by the extension to give your app a name, choose a framework preset, -> and designate the app root (usually /) and built file location /dist. The wizard will run and will +> Follow the wizard started by the extension to give your app a name, choose a framework preset, +> and designate the app root (usually /) and built file location /dist. The wizard will run and will > create a GitHub action in your repo in a .github folder. This created the GitHub Action workflow, which looks like the [Build configuration here](https://learn.microsoft.com/en-us/azure/static-web-apps/build-configuration?tabs=github-actions#build-configuration). + + + +[api-game-lib Deployment Center]: https://portal.azure.com/#@spawarottijamro.onmicrosoft.com/resource/subscriptions/8695c84c-09a4-4b50-994f-a2fa7f36cc92/resourceGroups/game-web/providers/Microsoft.Web/sites/api-game-lib/vstscd +[Continuous deployment to Azure App Service]: https://learn.microsoft.com/en-us/azure/app-service/deploy-continuous-deployment?tabs=github +[Azure App Service CD FAQ]: https://learn.microsoft.com/en-us/azure/app-service/deploy-continuous-deployment?tabs=github#frequently-asked-questions +[commit with API GHAW from Depl Center]: https://github.com/konrad-jamrozik/game/commit/9f1f5143aab4953ffc821fda2b0f18cb9825dc18 +[commit with API GHAW fix]: https://github.com/konrad-jamrozik/game/commit/463e9e74ef2b89cbb2ef1755b0bfb830208722f4 +[api-game-lib.yml git history]: https://github.com/konrad-jamrozik/game/commits/main/.github/workflows/api-game-lib.yml +[GitHub actions secrets]: https://github.com/konrad-jamrozik/game/settings/secrets/actions