From 2515dffe4be446edc51ac66aaca54b201b2bac81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw?= <62651497+staszkiet@users.noreply.github.com> Date: Sat, 19 Apr 2025 15:58:58 +0200 Subject: [PATCH 1/7] Add deploy yml --- .github/workflows/deployapi.yml | 67 +++++++++++++++++++++++++++++++++ TickAPI/TickAPI/TickAPI.csproj | 7 +++- 2 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/deployapi.yml diff --git a/.github/workflows/deployapi.yml b/.github/workflows/deployapi.yml new file mode 100644 index 0000000..1c63575 --- /dev/null +++ b/.github/workflows/deployapi.yml @@ -0,0 +1,67 @@ +# 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 - resellio + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + 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: '9.x' + + - name: Build with dotnet + run: dotnet build TickAPI/TickAPI/TickAPI.csproj --configuration Release + + - name: dotnet publish + run: dotnet publish TickAPI/TickAPI/TickAPI.csproj -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: + runs-on: windows-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.AZUREAPPSERVICE_CLIENTID_F22C931708554F8B83EE4F83C4FED407 }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_6CDAC678ACD94858BF3421F606456B8B }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_CA368EC8EA37446E96D5DF5F42B650EA }} + + - name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@v3 + with: + app-name: 'resellio' + slot-name: 'Production' + package: . diff --git a/TickAPI/TickAPI/TickAPI.csproj b/TickAPI/TickAPI/TickAPI.csproj index 1e131f6..e1b2c68 100644 --- a/TickAPI/TickAPI/TickAPI.csproj +++ b/TickAPI/TickAPI/TickAPI.csproj @@ -1,17 +1,20 @@ - + net9.0 enable enable - + 9eaa86f9-f226-40d9-82e5-ca6c514f791c + + + all From 0c743b01e26884a3168d0b6c0ef7bf7a00cbc3ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw?= <62651497+staszkiet@users.noreply.github.com> Date: Sat, 19 Apr 2025 16:05:03 +0200 Subject: [PATCH 2/7] Trigger action --- .../Customers/Controllers/CustomerControllerTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TickAPI/TickAPI.Tests/Customers/Controllers/CustomerControllerTests.cs b/TickAPI/TickAPI.Tests/Customers/Controllers/CustomerControllerTests.cs index 8e9eadd..b06dbf1 100644 --- a/TickAPI/TickAPI.Tests/Customers/Controllers/CustomerControllerTests.cs +++ b/TickAPI/TickAPI.Tests/Customers/Controllers/CustomerControllerTests.cs @@ -20,6 +20,8 @@ public class CustomerControllerTests public async Task GoogleLogin_WhenAuthSuccessAndCustomerExists_ShouldReturnToken() { // Arrange + + //c const string email = "existing@test.com"; const string accessToken = "valid-google-token"; const string jwtToken = "valid-jwt-token"; From 9332cf6a55f0fabed6f725105063c8a1e163cb48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw?= <62651497+staszkiet@users.noreply.github.com> Date: Sat, 19 Apr 2025 16:09:07 +0200 Subject: [PATCH 3/7] Test yml on fest/actions --- .github/workflows/deployapi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deployapi.yml b/.github/workflows/deployapi.yml index 1c63575..9d03751 100644 --- a/.github/workflows/deployapi.yml +++ b/.github/workflows/deployapi.yml @@ -1,12 +1,12 @@ # 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 - resellio +name: Build and deploy Resellio Backend on: push: branches: - - main + - feat/actions workflow_dispatch: jobs: From accd4fb9dc217416ca21b6f0ea5f1b0cf906f75a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw?= <62651497+staszkiet@users.noreply.github.com> Date: Sat, 19 Apr 2025 16:15:18 +0200 Subject: [PATCH 4/7] Deploy form main --- .github/workflows/deployapi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployapi.yml b/.github/workflows/deployapi.yml index 9d03751..ce14923 100644 --- a/.github/workflows/deployapi.yml +++ b/.github/workflows/deployapi.yml @@ -6,7 +6,7 @@ name: Build and deploy Resellio Backend on: push: branches: - - feat/actions + - main workflow_dispatch: jobs: From 3568f60e0370e1c5f1c8c980f9b1d8d470ecf4e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw?= <62651497+staszkiet@users.noreply.github.com> Date: Sat, 19 Apr 2025 16:23:23 +0200 Subject: [PATCH 5/7] Update CustomersControllerTests.cs --- .../Customers/Controllers/CustomersControllerTests.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/TickAPI/TickAPI.Tests/Customers/Controllers/CustomersControllerTests.cs b/TickAPI/TickAPI.Tests/Customers/Controllers/CustomersControllerTests.cs index b9aad91..fe8999a 100644 --- a/TickAPI/TickAPI.Tests/Customers/Controllers/CustomersControllerTests.cs +++ b/TickAPI/TickAPI.Tests/Customers/Controllers/CustomersControllerTests.cs @@ -20,8 +20,6 @@ public class CustomersControllerTests public async Task GoogleLogin_WhenAuthSuccessAndCustomerExists_ShouldReturnToken() { // Arrange - - //c const string email = "existing@test.com"; const string accessToken = "valid-google-token"; const string jwtToken = "valid-jwt-token"; @@ -196,4 +194,4 @@ public async Task AboutMe_WithMissingEmailClaim_ShouldReturnBadRequest() Assert.Equal(StatusCodes.Status400BadRequest, objectResult.StatusCode); Assert.Equal("missing email claim", objectResult.Value); } -} \ No newline at end of file +} From 6cf62c8434c243cb438dbac0ba84d74ee28abcc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw?= <62651497+staszkiet@users.noreply.github.com> Date: Sat, 19 Apr 2025 16:30:50 +0200 Subject: [PATCH 6/7] Delete app configuration rubbish --- TickAPI/TickAPI/TickAPI.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/TickAPI/TickAPI/TickAPI.csproj b/TickAPI/TickAPI/TickAPI.csproj index e1b2c68..26ae670 100644 --- a/TickAPI/TickAPI/TickAPI.csproj +++ b/TickAPI/TickAPI/TickAPI.csproj @@ -4,17 +4,14 @@ net9.0 enable enable - 9eaa86f9-f226-40d9-82e5-ca6c514f791c - - all From 129936ecfb37f175ed63e4092022540c4905491c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw?= <62651497+staszkiet@users.noreply.github.com> Date: Sat, 19 Apr 2025 16:39:50 +0200 Subject: [PATCH 7/7] Update TickAPI.csproj Add tab for @kTrzcinskii --- TickAPI/TickAPI/TickAPI.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TickAPI/TickAPI/TickAPI.csproj b/TickAPI/TickAPI/TickAPI.csproj index 26ae670..aeff0ec 100644 --- a/TickAPI/TickAPI/TickAPI.csproj +++ b/TickAPI/TickAPI/TickAPI.csproj @@ -4,7 +4,7 @@ net9.0 enable enable - +