diff --git a/.github/workflows/OpenIDConnect.yml b/.github/workflows/OpenIDConnect.yml new file mode 100644 index 000000000..cbefce24a --- /dev/null +++ b/.github/workflows/OpenIDConnect.yml @@ -0,0 +1,51 @@ +name: .NET Core + +on: [push] + +permissions: + id-token: write + contents: read + +env: + AZURE_WEBAPP_NAME: githubtest1 # Set this to your application's name + AZURE_WEBAPP_PACKAGE_PATH: '.' # Set this to the path to your web app project, defaults to the repository root + DOTNET_VERSION: '6.0.x' # Set this to the dot net version to use + +jobs: + build: + runs-on: windows-latest + + steps: + # Check out the repo + - uses: actions/checkout@main + - uses: azure/login@v2 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + environment: AzureChinaCloud + + + # Setup .NET Core SDK + - name: Setup .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + # Run dotnet build and publish + - name: dotnet build and publish + run: | + dotnet restore + dotnet build --configuration Release + dotnet publish -c Release --property:PublishDir='${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp' + + # Deploy to Azure Web apps + - name: 'Run Azure webapp deploy action using publish profile credentials' + uses: azure/webapps-deploy@v3 + with: + app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name + package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp' + + - name: logout + run: | + az logout diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..2933fa40c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,35 @@ +on: [pull_request] + +env: + AZURE_WEBAPP_NAME: githubtest2 # Set this to your application's name + AZURE_WEBAPP_PACKAGE_PATH: '.' # Set this to the path to your web app project, defaults to the repository root + DOTNET_VERSION: '6.0.x' # Set this to the dot net version to use + +jobs: + build: + runs-on: windows-latest + + steps: + # Check out the repo + - uses: actions/checkout@master + + # Setup .NET Core SDK + - name: Setup .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + # Run dotnet build and publish + - name: dotnet build and publish + run: | + dotnet restore + dotnet build --configuration Release + dotnet publish -c Release --property:PublishDir='${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp' + + # Deploy to Azure Web apps + - name: 'Run Azure webapp deploy action using publish profile credentials' + uses: azure/webapps-deploy@v3 + with: + app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name + publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} # Define secret variable in repository settings as per action documentation + package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp' diff --git a/.github/workflows/maincredentials.yml b/.github/workflows/maincredentials.yml new file mode 100644 index 000000000..9f9a98aa4 --- /dev/null +++ b/.github/workflows/maincredentials.yml @@ -0,0 +1,43 @@ +name: .NET Core CREDENTIALS + +on: [pull_request] + +env: + AZURE_WEBAPP_NAME: githubtest1 # Set this to your application's name + AZURE_WEBAPP_PACKAGE_PATH: '.' # Set this to the path to your web app project, defaults to the repository root + DOTNET_VERSION: '6.0.x' # Set this to the dot net version to use + +jobs: + build: + runs-on: windows-latest + + steps: + # Check out the repo + - uses: actions/checkout@master + - uses: azure/login@v2 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + # Setup .NET Core SDK + - name: Setup .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + # Run dotnet build and publish + - name: dotnet build and publish + run: | + dotnet restore + dotnet build --configuration Release + dotnet publish -c Release --property:PublishDir='${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp' + + # Deploy to Azure Web apps + - name: 'Run Azure webapp deploy action using Azure Credentials' + uses: azure/webapps-deploy@v3 + with: + app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name + package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp' + + - name: logout + run: | + az logout diff --git a/Pages/Index.cshtml b/Pages/Index.cshtml index a6f4512df..92a7c9af9 100644 --- a/Pages/Index.cshtml +++ b/Pages/Index.cshtml @@ -5,7 +5,7 @@ }
Learn about building Web apps with ASP.NET Core.