-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Create deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml #155
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
Open
rfernandezdo
wants to merge
3
commits into
mspnp:main
Choose a base branch
from
rfernandezdo:patch-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
107 changes: 107 additions & 0 deletions
107
.github/workflows/deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # This workflow builds and deploys a .NET Core application to an Azure Web App when a push is made to the main branch. | ||
| # | ||
| # This workflow assumes you have already created the target Azure App Service Web App. | ||
| # For instructions, see: https://docs.microsoft.com/en-us/azure/app-service/quickstart-dotnetcore?tabs=net60&pivots=development-environment-vscode | ||
| # | ||
| # Workflow setup: | ||
| # | ||
| # 1. Create the following secrets in your repository: | ||
| # - AZURE_CLIENT_ID: The ID of your Azure AD registered application. | ||
| # - AZURE_TENANT_ID: Your Azure AD tenant ID. | ||
| # - AZURE_SUBSCRIPTION_ID: Your Azure subscription ID. | ||
| # - AZURE_WEBAPP_NAME: The name of your Azure App Service. | ||
| # | ||
| # This workflow uses OIDC authentication to securely connect to Azure. | ||
| # | ||
| # More information about GitHub Actions for Azure: https://github.com/Azure/Actions | ||
| # More information about the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy | ||
| # More workflow samples for deploying to Azure: https://github.com/Azure/actions-workflow-samples | ||
|
|
||
| # Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy | ||
| # More GitHub Actions for Azure: https://github.com/Azure/actions | ||
|
|
||
| name: Build and deploy ASP.Net Core app to Azure Web App - azurenamingtool | ||
|
|
||
| env: | ||
| AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root | ||
| AZURE_WEBAPP_SLOT_NAME: 'Production' | ||
| DOTNET_VERSION: '8.0.x' | ||
|
|
||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
|
|
||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: src | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: src | ||
| permissions: | ||
| contents: read #This is required for actions/checkout | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up .NET Core | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
|
||
| - name: Build with dotnet | ||
| run: dotnet build --configuration Release | ||
|
|
||
| - name: dotnet publish | ||
| run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp | ||
|
|
||
| - name: Upload artifact for deployment job | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: .net-app | ||
| path: ${{env.DOTNET_ROOT}}/myapp | ||
|
|
||
| deploy: | ||
| defaults: | ||
| run: | ||
| working-directory: . | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| environment: | ||
| name: 'Production' | ||
| url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | ||
| permissions: | ||
| id-token: write #This is required for requesting the JWT | ||
| contents: read #This is required for actions/checkout | ||
|
|
||
| steps: | ||
| - name: Download artifact from build job | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: .net-app | ||
|
|
||
| - name: Login to Azure | ||
| uses: azure/login@v2 | ||
| with: | ||
| client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
|
|
||
| - name: Deploy to Azure Web App | ||
| id: deploy-to-webapp | ||
| uses: azure/webapps-deploy@v3 | ||
| with: | ||
| app-name: ${{ secrets.AZURE_WEBAPP_NAME }} | ||
| slot-name: ${{env.AZURE_WEBAPP_SLOT_NAME}} | ||
| package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} | ||
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.
Uh oh!
There was an error while loading. Please reload this page.