Skip to content

Commit c149d4f

Browse files
committed
More tweaks to see if we can make the release workflow run only on the release branch.
1 parent 7357f59 commit c149d4f

1 file changed

Lines changed: 6 additions & 23 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ permissions:
3939
jobs:
4040
check-and-release:
4141
runs-on: ubuntu-latest
42+
# Only run if the triggering workflow succeeded AND it ran on the release branch
43+
if: ${{ github.event.workflow_run.head_branch == 'release' && github.event.workflow_run.conclusion == 'success' }}
4244
steps:
4345
- name: Log trigger information
4446
run: |
@@ -47,26 +49,7 @@ jobs:
4749
echo "Branch: ${{ github.event.workflow_run.head_branch }}"
4850
echo "Commit SHA: ${{ github.event.workflow_run.head_sha }}"
4951
50-
- name: Validate release branch and workflow success
51-
id: validate
52-
run: |
53-
if [ "${{ github.event.workflow_run.head_branch }}" != "release" ]; then
54-
echo "Skipping: Not on release branch (on ${{ github.event.workflow_run.head_branch }})"
55-
echo "proceed=false" >> $GITHUB_OUTPUT
56-
exit 0
57-
fi
58-
59-
if [ "${{ github.event.workflow_run.conclusion }}" != "success" ]; then
60-
echo "Skipping: Workflow did not succeed (conclusion: ${{ github.event.workflow_run.conclusion }})"
61-
echo "proceed=false" >> $GITHUB_OUTPUT
62-
exit 0
63-
fi
64-
65-
echo "Validation passed: On release branch with successful workflow"
66-
echo "proceed=true" >> $GITHUB_OUTPUT
67-
6852
- name: Check all workflow statuses
69-
if: steps.validate.outputs.proceed == 'true'
7053
id: check-all
7154
uses: actions/github-script@v7
7255
with:
@@ -165,14 +148,14 @@ jobs:
165148
core.setOutput("ready", "true");
166149
167150
- name: Perform Release
168-
if: steps.validate.outputs.proceed == 'true' && steps.check-all.outputs.ready == 'true'
151+
if: steps.check-all.outputs.ready == 'true'
169152
uses: actions/checkout@v4
170153
with:
171154
ref: ${{ github.event.workflow_run.head_sha }}
172155
fetch-depth: 0
173156

174157
- name: Get Version
175-
if: steps.validate.outputs.proceed == 'true' && steps.check-all.outputs.ready == 'true'
158+
if: steps.check-all.outputs.ready == 'true'
176159
run: |
177160
if [ ! -f VERSION ]; then
178161
echo "ERROR: VERSION file not found"
@@ -183,7 +166,7 @@ jobs:
183166
echo "VERSION=$VERSION" >> $GITHUB_ENV
184167
185168
- name: Get Release Details
186-
if: steps.validate.outputs.proceed == 'true' && steps.check-all.outputs.ready == 'true'
169+
if: steps.check-all.outputs.ready == 'true'
187170
id: release_details
188171
uses: actions/github-script@v7
189172
with:
@@ -222,7 +205,7 @@ jobs:
222205
core.setOutput("body", body);
223206
224207
- name: Create Release
225-
if: steps.validate.outputs.proceed == 'true' && steps.check-all.outputs.ready == 'true'
208+
if: steps.check-all.outputs.ready == 'true'
226209
uses: softprops/action-gh-release@v1
227210
with:
228211
tag_name: v${{ env.VERSION }}

0 commit comments

Comments
 (0)