|
16 | 16 | OPENSHIFT_NAMESPACE_DEV: 6cdc9e-dev |
17 | 17 | IMAGE_NAME: eagle-admin |
18 | 18 | APP_NAME: eagle-admin |
19 | | - TEST_PROMO_BRANCH: promotion/test |
20 | | - TEST_PROMO_PR_BRANCH: promotion/test-pr |
21 | 19 |
|
22 | 20 | jobs: |
23 | 21 | install: |
@@ -215,57 +213,3 @@ jobs: |
215 | 213 | |
216 | 214 | echo "Deployment successful!" |
217 | 215 | oc get pods -n ${{ env.OPENSHIFT_NAMESPACE_DEV }} -l app.kubernetes.io/name=${{ env.APP_NAME }} |
218 | | -
|
219 | | - promotion: |
220 | | - name: Create Promotion Pull Request |
221 | | - needs: push |
222 | | - runs-on: ubuntu-latest |
223 | | - steps: |
224 | | - # Update promotion/test-pr with new commit hash |
225 | | - - name: Checkout promotion/test |
226 | | - uses: actions/checkout@v3 |
227 | | - with: |
228 | | - ref: "${{ env.TEST_PROMO_BRANCH }}" |
229 | | - - name: Update state.json |
230 | | - id: update-state |
231 | | - run: | |
232 | | - git config --global user.name "${{ github.actor }}" |
233 | | - git config --global user.email "${{github.actor}}@users.noreply.github.com" |
234 | | -
|
235 | | - git checkout -B ${{ env.TEST_PROMO_PR_BRANCH }} |
236 | | - git reset --hard ${{ env.TEST_PROMO_BRANCH }} |
237 | | -
|
238 | | - echo $(jq '.commit="${{ needs.push.outputs.SHORT_SHA }}"' state.json) > state.json |
239 | | -
|
240 | | - # Only commit if there are changes |
241 | | - if git diff --quiet state.json; then |
242 | | - echo "No changes to state.json, skipping commit" |
243 | | - echo "has_changes=false" >> $GITHUB_OUTPUT |
244 | | - else |
245 | | - git commit -am "Promote commit ${{ needs.push.outputs.SHORT_SHA }} to Test" |
246 | | - git push --force origin ${{ env.TEST_PROMO_PR_BRANCH }} |
247 | | - echo "has_changes=true" >> $GITHUB_OUTPUT |
248 | | - fi |
249 | | - - name: Create or Update Pull Request |
250 | | - if: steps.update-state.outputs.has_changes == 'true' |
251 | | - run: | |
252 | | - # Check if PR exists |
253 | | - PR_URL=$(gh pr list --base "${{ env.TEST_PROMO_BRANCH }}" --head "${{ env.TEST_PROMO_PR_BRANCH }}" --json url --jq '.[0].url') |
254 | | - if [ -z "$PR_URL" ]; then |
255 | | - # Create PR if it doesn't exist |
256 | | - gh pr create \ |
257 | | - --base "${{ env.TEST_PROMO_BRANCH }}" \ |
258 | | - --head "${{ env.TEST_PROMO_PR_BRANCH }}" \ |
259 | | - --title "Deploy to Test Environment" \ |
260 | | - --body ":crown: *An automated PR*\n\nThis PR triggers a deployment to Test once it's fully merged." \ |
261 | | - --label "auto-pr,test env,pipeline" \ |
262 | | - --draft |
263 | | - else |
264 | | - # Update PR if it exists |
265 | | - gh pr edit "$PR_URL" \ |
266 | | - --title "Deploy to Test Environment" \ |
267 | | - --body ":crown: *An automated PR*\n\nThis PR triggers a deployment to Test once it's fully merged." \ |
268 | | - --add-label "auto-pr,test env,pipeline" |
269 | | - fi |
270 | | - env: |
271 | | - GH_TOKEN: ${{ github.token }} |
0 commit comments