From d68b5123cde0fd21b92658b20633211a5c5b4518 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Mon, 8 Sep 2025 10:25:10 +0200 Subject: [PATCH 1/3] added ci pipeline --- .github/workflows/ci.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d39dd033..e2e6075f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,8 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0 + cache: true + cache-dependency-path: "**/packages.lock.json" - name: Build with dotnet run: dotnet build --configuration Release @@ -26,4 +28,20 @@ jobs: - uses: actions/upload-artifact@v4 with: name: dometrain-artifact - path: artifacts/ \ No newline at end of file + path: artifacts/ + + deploy-dev: + name: Deploy Dev + runs-on: ubuntu-latest + + steps: + - uses: actions/download/artifact@v4 + with: + name: dometrain-artifact + path: artifacts/ + + - name: 'Deploy to Azure App Service' + uses: azure/webapps-deploy@v2 + with: + app-name: app-dometrain-github-actions-erisjakupi-dev + package: artifacts/ \ No newline at end of file From 9455da75a297dbfb2b558f1aaf05043a5f528aea Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Mon, 8 Sep 2025 10:39:51 +0200 Subject: [PATCH 2/3] modified ci.yml --- .github/workflows/ci.yml | 48 ++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2e6075f..ca07c7ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: CI on: push: - branches: [ "main" ] + branches: ["main"] jobs: build: @@ -18,30 +18,34 @@ jobs: dotnet-version: 8.0 cache: true cache-dependency-path: "**/packages.lock.json" - - - name: Build with dotnet - run: dotnet build --configuration Release + + - name: dotnet restore + run: dotnet restore --locked-mode + + - name: dotnet test + run: dotnet test --configuration Release --no-restore - name: dotnet publish run: dotnet publish src/GitHubActionsDotNet.Api/GitHubActionsDotNet.Api.csproj --configuration Release -o artifacts - uses: actions/upload-artifact@v4 with: - name: dometrain-artifact - path: artifacts/ - - deploy-dev: - name: Deploy Dev - runs-on: ubuntu-latest - - steps: - - uses: actions/download/artifact@v4 - with: - name: dometrain-artifact - path: artifacts/ - - - name: 'Deploy to Azure App Service' - uses: azure/webapps-deploy@v2 - with: - app-name: app-dometrain-github-actions-erisjakupi-dev - package: artifacts/ \ No newline at end of file + name: dometrain-artifact + path: artifacts/ + + deploy_dev: + name: Deploy Dev + runs-on: ubuntu-latest + needs: build + + steps: + - uses: actions/download-artifact@v4 + with: + name: dometrain-artifact + path: artifacts/ + + - name: "Deploy to Azure App Service" + uses: azure/webapps-deploy@v2 + with: + app-name: app-dometrain-github-actions-erisjakupi-dev + package: artifacts/ \ No newline at end of file From 21e17efea03c13782af4c3e28abc74afe24bafb9 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Fri, 12 Sep 2025 10:27:53 +0200 Subject: [PATCH 3/3] add azure login --- .github/workflows/ci.yml | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca07c7ff..3b763fab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,8 @@ name: CI on: push: - branches: ["main"] + branches: + - main jobs: build: @@ -10,7 +11,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - name: Set up .NET Core uses: actions/setup-dotnet@v4 @@ -19,16 +21,17 @@ jobs: cache: true cache-dependency-path: "**/packages.lock.json" - - name: dotnet restore + - name: Restore dependencies run: dotnet restore --locked-mode - - name: dotnet test + - name: Run tests run: dotnet test --configuration Release --no-restore - - name: dotnet publish + - name: Publish application run: dotnet publish src/GitHubActionsDotNet.Api/GitHubActionsDotNet.Api.csproj --configuration Release -o artifacts - - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: dometrain-artifact path: artifacts/ @@ -39,13 +42,21 @@ jobs: needs: build steps: - - uses: actions/download-artifact@v4 + - name: Download artifact + uses: actions/download-artifact@v4 with: name: dometrain-artifact path: artifacts/ - - name: "Deploy to Azure App Service" + - name: Azure login + 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 App Service uses: azure/webapps-deploy@v2 with: app-name: app-dometrain-github-actions-erisjakupi-dev - package: artifacts/ \ No newline at end of file + package: artifacts/