diff --git a/.github/workflows/deploy-to-azure.yml b/.github/workflows/deploy-to-azure.yml index 91e1bd5..e8f5b87 100644 --- a/.github/workflows/deploy-to-azure.yml +++ b/.github/workflows/deploy-to-azure.yml @@ -5,7 +5,7 @@ on: environment: description: 'Environment to deploy to' required: true - default: 'development' + default: 'develop' type: choice options: - production @@ -24,7 +24,7 @@ jobs: run: | case "${{ inputs.environment }}" in testing) echo "target_env=Testing" >> $GITHUB_OUTPUT ;; - development) echo "target_env=dev" >> $GITHUB_OUTPUT ;; + develop) echo "target_env=dev" >> $GITHUB_OUTPUT ;; staging) echo "target_env=stage" >> $GITHUB_OUTPUT ;; production) echo "target_env=prod" >> $GITHUB_OUTPUT ;; esac @@ -63,4 +63,5 @@ jobs: app_location: ".output/public" # App source code path api_location: "" # Api source code path - optional output_location: "" # Built app content directory - optional - skip_app_build: true \ No newline at end of file + skip_app_build: true + production_branch: ${{ inputs.environment }} \ No newline at end of file diff --git a/.github/workflows/trigger-deploy-on-merge.yml b/.github/workflows/trigger-deploy-on-merge.yml new file mode 100644 index 0000000..1849150 --- /dev/null +++ b/.github/workflows/trigger-deploy-on-merge.yml @@ -0,0 +1,21 @@ +name: Trigger Deployment on Pull Request Merge +on: + pull_request: + types: [closed] + branches: [develop, staging, production, testing] +permissions: + contents: read + actions: write + +jobs: + deploy-frontend: + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Trigger Frontend Deployment Workflow + run: | + gh workflow run deploy-to-azure.yml \ + --repo ${{ github.repository }} \ + --ref ${{ github.base_ref }} \ + --field environment=${{ github.event.pull_request.base.ref }}