From 1ed97dbcd618656d0b7c84a2eccc61409ab71894 Mon Sep 17 00:00:00 2001
From: dev-ojeda <31727824+dev-ojeda@users.noreply.github.com>
Date: Thu, 30 Nov 2023 04:13:36 -0300
Subject: [PATCH] Create build.yml

---
 .github/workflows/build.yml | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 .github/workflows/build.yml

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 00000000..cae15e34
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,35 @@
+name: eShop build
+
+on:
+  push:
+    paths:
+    - 'src/Services/Coupon/**'
+    - 'tests/Services/Coupon/**'
+    branches: [ main ]
+
+jobs:
+  build-and-push-docker-image:
+    runs-on: ubuntu-latest
+    steps:
+    - name: Get code from the repository
+      uses: actions/checkout@v1
+      with:
+        ref: main
+
+    - name: Run unit tests
+      run: dotnet test tests/Services/Coupon/*.Tests/*.csproj
+      env:
+        DOTNET_CLI_TELEMETRY_OPTOUT: true
+        DOTNET_NOLOGO: true
+
+    - name: Build and push Docker image
+      uses: docker/build-push-action@v1.1.0
+      with:
+        username: ${{ secrets.REGISTRY_USERNAME }}
+        password: ${{ secrets.REGISTRY_PASSWORD }}
+        registry: ${{ secrets.REGISTRY_LOGIN_SERVER }}
+        path: .
+        dockerfile: './src/Services/Coupon/Coupon.API/Dockerfile.acr'
+        repository: 'coupon.api'
+        tags: 'linux-net6-coupon'
+        push: true