|
12 | 12 | # - Then deploys to test environment (if dev succeeds) |
13 | 13 | # - Validates image existence before deployment |
14 | 14 | # - Uses edge tag by default, or custom tag if specified |
| 15 | +# - When triggered by build-edge, uses commit SHA so Azure actually pulls a new image |
| 16 | +# - When manually triggered, uses provided tag or edge |
15 | 17 |
|
16 | 18 | name: Deploy to Dev and Test |
17 | 19 |
|
|
39 | 41 | deploy-to-dev: |
40 | 42 | runs-on: ubuntu-latest |
41 | 43 | environment: dev |
| 44 | + env: |
| 45 | + IMAGE_TAG: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.event.inputs.image_tag || 'edge' }} |
42 | 46 | steps: |
43 | 47 | # Check that images exist before deploying (only for manual dispatch with custom tags) |
44 | 48 | - uses: tyriis/docker-image-tag-exists@71a750a41aa78e4efb0842f538140c5df5b8166f # v2.1.0 |
@@ -74,58 +78,60 @@ jobs: |
74 | 78 | with: |
75 | 79 | app-name: ${{ vars.AZURE_WEBAPP_NAME }} |
76 | 80 | publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} |
77 | | - images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/backend:${{ github.event.inputs.image_tag || 'edge' }} |
| 81 | + images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/backend:${{ env.IMAGE_TAG }} |
78 | 82 |
|
79 | 83 | - name: Deploy Frontend to Dev |
80 | 84 | uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2 |
81 | 85 | with: |
82 | 86 | app-name: ${{ vars.AZURE_WEBAPP_NEXT_NAME }} |
83 | 87 | publish-profile: ${{ secrets.AZURE_WEBAPP_NEXT_PUBLISH_PROFILE }} |
84 | | - images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/frontend:${{ github.event.inputs.image_tag || 'edge' }} |
| 88 | + images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/frontend:${{ env.IMAGE_TAG }} |
85 | 89 |
|
86 | 90 | - name: Deploy Airflow Webserver to Dev |
87 | 91 | uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2 |
88 | 92 | with: |
89 | 93 | app-name: ${{ vars.AIRFLOW_WEBSERVER_NAME }} |
90 | 94 | publish-profile: ${{ secrets.AIRFLOW_WEBSERVER_PUBLISH_PROFILE }} |
91 | | - images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/airflow-webserver:${{ github.event.inputs.image_tag || 'edge' }} |
| 95 | + images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/airflow-webserver:${{ env.IMAGE_TAG }} |
92 | 96 |
|
93 | 97 | - name: Deploy Airflow Scheduler to Dev |
94 | 98 | uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2 |
95 | 99 | with: |
96 | 100 | app-name: ${{ vars.AIRFLOW_SCHEDULER_NAME }} |
97 | 101 | publish-profile: ${{ secrets.AIRFLOW_SCHEDULER_PUBLISH_PROFILE }} |
98 | | - images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/airflow-scheduler:${{ github.event.inputs.image_tag || 'edge' }} |
| 102 | + images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/airflow-scheduler:${{ env.IMAGE_TAG }} |
99 | 103 |
|
100 | 104 | deploy-to-test: |
101 | 105 | runs-on: ubuntu-latest |
102 | 106 | environment: test |
103 | 107 | needs: [deploy-to-dev] |
| 108 | + env: |
| 109 | + IMAGE_TAG: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.event.inputs.image_tag || 'edge' }} |
104 | 110 | steps: |
105 | 111 | - name: Deploy Backend to Test |
106 | 112 | uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2 |
107 | 113 | with: |
108 | 114 | app-name: ${{ vars.AZURE_WEBAPP_NAME }} |
109 | 115 | publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} |
110 | | - images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/backend:${{ github.event.inputs.image_tag || 'edge' }} |
| 116 | + images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/backend:${{ env.IMAGE_TAG }} |
111 | 117 |
|
112 | 118 | - name: Deploy Frontend to Test |
113 | 119 | uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2 |
114 | 120 | with: |
115 | 121 | app-name: ${{ vars.AZURE_WEBAPP_NEXT_NAME }} |
116 | 122 | publish-profile: ${{ secrets.AZURE_WEBAPP_NEXT_PUBLISH_PROFILE }} |
117 | | - images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/frontend:${{ github.event.inputs.image_tag || 'edge' }} |
| 123 | + images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/frontend:${{ env.IMAGE_TAG }} |
118 | 124 |
|
119 | 125 | - name: Deploy Airflow Webserver to Test |
120 | 126 | uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2 |
121 | 127 | with: |
122 | 128 | app-name: ${{ vars.AIRFLOW_WEBSERVER_NAME }} |
123 | 129 | publish-profile: ${{ secrets.AIRFLOW_WEBSERVER_PUBLISH_PROFILE }} |
124 | | - images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/airflow-webserver:${{ github.event.inputs.image_tag || 'edge' }} |
| 130 | + images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/airflow-webserver:${{ env.IMAGE_TAG }} |
125 | 131 |
|
126 | 132 | - name: Deploy Airflow Scheduler to Test |
127 | 133 | uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2 |
128 | 134 | with: |
129 | 135 | app-name: ${{ vars.AIRFLOW_SCHEDULER_NAME }} |
130 | 136 | publish-profile: ${{ secrets.AIRFLOW_SCHEDULER_PUBLISH_PROFILE }} |
131 | | - images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/airflow-scheduler:${{ github.event.inputs.image_tag || 'edge' }} |
| 137 | + images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/airflow-scheduler:${{ env.IMAGE_TAG }} |
0 commit comments