From 8409280a92e7d3e6b517cba441ef1bfde931294c Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Fri, 19 Sep 2025 10:12:01 +0200 Subject: [PATCH 1/5] add reusable workflow --- .github/workflows/ci.yml | 46 ++++--------------------------- .github/workflows/step-deploy.yml | 42 ++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/step-deploy.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2772ade..2231906c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,49 +41,15 @@ jobs: deploy_dev: name: Deploy Dev - runs-on: ubuntu-latest needs: build - environment: dev + uses: ./github/workflows/step-deploy.yml + with: + env: dev - steps: - - name: Download artifact - uses: actions/download-artifact@v4 - with: - name: dometrain-artifact - path: artifacts/ - - - 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/ deploy_prod: name: Deploy Prod - runs-on: ubuntu-latest needs: deploy_dev - environment: prod - - steps: - - name: Download artifact - uses: actions/download-artifact@v4 - with: - name: dometrain-artifact - path: artifacts/ - - - name: Azure login - uses: azure/login@v2 - with: - client-id: ${{ secrets.PROD_AZURE_CLIENT_ID }} - tenant-id: ${{ secrets.AZURE_TENANT_ID }} - subscription-id: ${{ secrets.PROD_AZURE_SUBSCRIPTION_ID }} - - - name: Deploy to Azure App Service - uses: azure/webapps-deploy@v2 + uses: ./github/workflows/step-deploy.yml + with: + env: prod diff --git a/.github/workflows/step-deploy.yml b/.github/workflows/step-deploy.yml new file mode 100644 index 00000000..179819a2 --- /dev/null +++ b/.github/workflows/step-deploy.yml @@ -0,0 +1,42 @@ +name: "Step - Deploy" + +on: + workflow_call: + inputs: + env: + required: true + type: string + secrets: + AZURE_CLIENT_ID: + required: true + AZURE_TENANT_ID: + required: true + AZURE_SUBSCRIPTION_ID: + required: true + +jobs: + deploy: + name: Deploy ${{ inputs.env}} + runs-on: ubuntu-latest + environment: dev + + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: dometrain-artifact + path: artifacts/ + + - 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-${{ inputs.env }} + package: artifacts/ + \ No newline at end of file From f29078e99683b597c2b9a569242727eb4f9a7085 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Fri, 19 Sep 2025 10:19:43 +0200 Subject: [PATCH 2/5] add dot --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2231906c..78607a83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: deploy_dev: name: Deploy Dev needs: build - uses: ./github/workflows/step-deploy.yml + uses: ./.github/workflows/step-deploy.yml with: env: dev @@ -50,6 +50,6 @@ jobs: deploy_prod: name: Deploy Prod needs: deploy_dev - uses: ./github/workflows/step-deploy.yml + uses: ./.github/workflows/step-deploy.yml with: env: prod From eeaaaa4f8f3c3a3f986bc86a7dbab6b018a7a523 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Fri, 19 Sep 2025 10:51:33 +0200 Subject: [PATCH 3/5] inherit secrets --- .github/workflows/ci.yml | 4 +++- .github/workflows/step-deploy.yml | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78607a83..7ec4d99d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,11 +40,12 @@ jobs: path: artifacts/ deploy_dev: - name: Deploy Dev + name: Deploy Dev needs: build uses: ./.github/workflows/step-deploy.yml with: env: dev + secrets: inherit deploy_prod: @@ -53,3 +54,4 @@ jobs: uses: ./.github/workflows/step-deploy.yml with: env: prod + secrets: inherit diff --git a/.github/workflows/step-deploy.yml b/.github/workflows/step-deploy.yml index 179819a2..665ecc9b 100644 --- a/.github/workflows/step-deploy.yml +++ b/.github/workflows/step-deploy.yml @@ -16,9 +16,9 @@ on: jobs: deploy: - name: Deploy ${{ inputs.env}} + name: Deploy ${{ inputs.env }} runs-on: ubuntu-latest - environment: dev + environment: ${{ inputs.env }} steps: - name: Download artifact From 80974c6368305f8d428f6d354be256992d627713 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Fri, 19 Sep 2025 11:22:44 +0200 Subject: [PATCH 4/5] small change --- .github/workflows/step-deploy.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/step-deploy.yml b/.github/workflows/step-deploy.yml index 665ecc9b..cd754fff 100644 --- a/.github/workflows/step-deploy.yml +++ b/.github/workflows/step-deploy.yml @@ -39,4 +39,6 @@ jobs: with: app-name: app-dometrain-github-actions-erisjakupi-${{ inputs.env }} package: artifacts/ - \ No newline at end of file + + + \ No newline at end of file From ecdcc291d895eb7e01672ec185f7e1230d6a5395 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Fri, 19 Sep 2025 11:28:00 +0200 Subject: [PATCH 5/5] removed --- .github/workflows/ci.yml | 9 --------- .github/workflows/step-deploy.yml | 1 - 2 files changed, 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ec4d99d..b4ec70a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,12 +46,3 @@ jobs: with: env: dev secrets: inherit - - - deploy_prod: - name: Deploy Prod - needs: deploy_dev - uses: ./.github/workflows/step-deploy.yml - with: - env: prod - secrets: inherit diff --git a/.github/workflows/step-deploy.yml b/.github/workflows/step-deploy.yml index cd754fff..923356de 100644 --- a/.github/workflows/step-deploy.yml +++ b/.github/workflows/step-deploy.yml @@ -41,4 +41,3 @@ jobs: package: artifacts/ - \ No newline at end of file