From 8409280a92e7d3e6b517cba441ef1bfde931294c Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Fri, 19 Sep 2025 10:12:01 +0200 Subject: [PATCH] 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