@@ -113,7 +113,7 @@ jobs:
113113
114114 release :
115115 name : Release Build
116- if : inputs.create_pr != 'true' && ( github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') || inputs.is_test != 'true')
116+ if : github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') || inputs.is_test != 'true'
117117 needs : build-extension-artifact
118118 runs-on : ubuntu-latest
119119 permissions :
@@ -139,63 +139,21 @@ jobs:
139139 with :
140140 name : charts
141141
142- - name : Commit build
143- run : |
144- git add ./{assets,charts,extensions,index.yaml}
145- git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}"
146- git push
147-
148- - name : Run chart-releaser
149- 150- with :
151- charts_dir : ./charts/*
152- env :
153- CR_TOKEN : ' ${{ secrets.GITHUB_TOKEN }}'
154- CR_SKIP_EXISTING : true
155-
156- release-create-pr :
157- name : Create PR for release build
158- if : inputs.create_pr == 'true' && (github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') || inputs.is_test != 'true')
159- needs : build-extension-artifact
160- runs-on : ubuntu-latest
161- permissions :
162- actions : write
163- contents : write
164- deployments : write
165- pages : write
166- # permission needed for PR creation on this job
167- pull-requests : write
168- outputs :
169- release-status : ${{ job.status }}
170- steps :
171- - name : Checkout
172- uses : actions/checkout@v5
173- with :
174- ref : ' ${{ inputs.target_branch }}'
175-
176- - name : Configure Git
177- run : |
178- git config user.name 'github-actions[bot]'
179- git config user.email 'github-actions[bot]@users.noreply.github.com'
180-
181- - name : Download build artifact
182- uses : actions/download-artifact@v5
183- with :
184- name : charts
185-
186- - name : Generate branch name based on date and time
142+ # this is if we want to create a PR instead of push directly to a branch
143+ - if : inputs.create_pr == 'true'
144+ name : Generate branch name based on date and time
187145 run : echo "NOW=$(date +'%Y-%m-%d-%H-%M-%S')" >> $GITHUB_ENV
188146
189- - name : Commit Changes and push to a branch
147+ - if : inputs.create_pr == 'true'
148+ name : Commit Changes and push to a branch
190149 run : |
191150 git checkout -b sync-${{ env.NOW }}
192151 git add ./{assets,charts,extensions,index.yaml}
193152 git commit -a -m "Merging extension ${{ inputs.tagged_release }} ${{ env.NOW }}"
194153 git push origin sync-${{ env.NOW }}
195154
196- - name : Create Pull Request
197- env :
198- GH_TOKEN : ${{ github.token }}
155+ - if : inputs.create_pr == 'true'
156+ name : Create Pull Request
199157 run : |
200158 # Create the PR using the GitHub CLI
201159 pr_number=$(gh pr create \
@@ -210,4 +168,20 @@ jobs:
210168 if [ -z "$pr_number" ]; then
211169 echo "Failed to create PR."
212170 exit 1
213- fi
171+ fi
172+ # end of PR creation
173+
174+ - if : inputs.create_pr != 'true'
175+ name : Commit build
176+ run : |
177+ git add ./{assets,charts,extensions,index.yaml}
178+ git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}"
179+ git push
180+
181+ - name : Run chart-releaser
182+ 183+ with :
184+ charts_dir : ./charts/*
185+ env :
186+ CR_TOKEN : ' ${{ secrets.GITHUB_TOKEN }}'
187+ CR_SKIP_EXISTING : true
0 commit comments