|
28 | 28 | permissions: |
29 | 29 | contents: write |
30 | 30 |
|
| 31 | + env: |
| 32 | + PR_BRANCH: update-release-${{ github.event.inputs.tag }} |
| 33 | + |
31 | 34 | steps: |
32 | 35 | - uses: actions/checkout@v3 |
33 | 36 |
|
@@ -76,11 +79,38 @@ jobs: |
76 | 79 | make image-push -e IMG=quay.io/${{ github.event.inputs.quay-organization }}/instascale-controller:stable |
77 | 80 |
|
78 | 81 | # Update dependencies |
79 | | - - name: Commit go.mod and go.sum changes back to repository |
| 82 | + - name: Commit go.mod and go.sum changes to the branch |
80 | 83 | uses: stefanzweifel/git-auto-commit-action@v4 |
81 | 84 | with: |
82 | 85 | commit_message: Update go.mod and go.sum to MCAD ${{ github.event.inputs.mcad-version }} |
83 | 86 | file_pattern: 'go.mod go.sum' |
| 87 | + create_branch: true |
| 88 | + branch: ${{ env.PR_BRANCH }} |
| 89 | + |
| 90 | + - name: Create a Pull request with code changes |
| 91 | + run: | |
| 92 | + if git branch -a | grep "${{ env.PR_BRANCH }}"; then |
| 93 | + GIT_BRANCH=${GITHUB_REF#refs/heads/} |
| 94 | + gh pr create --base "$GIT_BRANCH" --fill --head "${{ env.PR_BRANCH }}" --label "lgtm" --label "approved" |
| 95 | + fi |
| 96 | + env: |
| 97 | + GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }} |
| 98 | + |
| 99 | + - name: Wait for PR to merge |
| 100 | + run: | |
| 101 | + if git branch -a | grep "${{ env.PR_BRANCH }}"; then |
| 102 | + timeout 3600 bash -c 'until [[ $(gh pr view '${{ env.PR_BRANCH }}' --json state --jq .state) == "MERGED" ]]; do sleep 5 && echo "$(gh pr view '${{ env.PR_BRANCH }}' --json state --jq .state)"; done' |
| 103 | + fi |
| 104 | + env: |
| 105 | + GITHUB_TOKEN: ${{ github.TOKEN }} |
| 106 | + |
| 107 | + - name: Delete the PR branch |
| 108 | + run: | |
| 109 | + if git branch -a | grep "${{ env.PR_BRANCH }}"; then |
| 110 | + git push origin --delete "${{ env.PR_BRANCH }}" |
| 111 | + fi |
| 112 | + env: |
| 113 | + GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }} |
84 | 114 |
|
85 | 115 | # Create a release in InstaScale |
86 | 116 | - name: Creates a release in GitHub |
|
89 | 119 | env: |
90 | 120 | GITHUB_TOKEN: ${{ github.TOKEN }} |
91 | 121 | shell: bash |
92 | | - |
|
0 commit comments