Skip to content

Commit 8840e26

Browse files
authored
fix broken test on extensions master workflow (#15676)
* fix broken test on extensions master workflow2 * address pr comments
1 parent bb1ef45 commit 8840e26

File tree

1 file changed

+48
-25
lines changed

1 file changed

+48
-25
lines changed

.github/workflows/build-extension-charts.yml

Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,57 @@ jobs:
113113

114114
release:
115115
name: Release Build
116-
if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') || inputs.is_test != 'true'
116+
if: inputs.create_pr != 'true' && (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:
120120
actions: write
121121
contents: write
122122
deployments: write
123123
pages: write
124+
outputs:
125+
release-status: ${{ job.status }}
126+
steps:
127+
- name: Checkout
128+
uses: actions/checkout@v5
129+
with:
130+
ref: '${{ inputs.target_branch }}'
131+
132+
- name: Configure Git
133+
run: |
134+
git config user.name 'github-actions[bot]'
135+
git config user.email 'github-actions[bot]@users.noreply.github.com'
136+
137+
- name: Download build artifact
138+
uses: actions/download-artifact@v5
139+
with:
140+
name: charts
141+
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+
uses: helm/[email protected]
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
124167
pull-requests: write
125168
outputs:
126169
release-status: ${{ job.status }}
@@ -140,21 +183,17 @@ jobs:
140183
with:
141184
name: charts
142185

143-
# this is if we want to create a PR instead of push directly to a branch
144-
- if: inputs.create_pr == 'true'
145-
name: Generate branch name based on date and time
186+
- name: Generate branch name based on date and time
146187
run: echo "NOW=$(date +'%Y-%m-%d-%H-%M-%S')" >> $GITHUB_ENV
147188

148-
- if: inputs.create_pr == 'true'
149-
name: Commit Changes and push to a branch
189+
- name: Commit Changes and push to a branch
150190
run: |
151191
git checkout -b sync-${{ env.NOW }}
152192
git add ./{assets,charts,extensions,index.yaml}
153193
git commit -a -m "Merging extension ${{ inputs.tagged_release }} ${{ env.NOW }}"
154194
git push origin sync-${{ env.NOW }}
155195
156-
- if: inputs.create_pr == 'true'
157-
name: Create Pull Request
196+
- name: Create Pull Request
158197
env:
159198
GH_TOKEN: ${{ github.token }}
160199
run: |
@@ -171,20 +210,4 @@ jobs:
171210
if [ -z "$pr_number" ]; then
172211
echo "Failed to create PR."
173212
exit 1
174-
fi
175-
# end of PR creation
176-
177-
- if: inputs.create_pr != 'true'
178-
name: Commit build
179-
run: |
180-
git add ./{assets,charts,extensions,index.yaml}
181-
git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}"
182-
git push
183-
184-
- name: Run chart-releaser
185-
uses: helm/[email protected]
186-
with:
187-
charts_dir: ./charts/*
188-
env:
189-
CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
190-
CR_SKIP_EXISTING: true
213+
fi

0 commit comments

Comments
 (0)