Skip to content

Commit af1a003

Browse files
committed
Make release process pull_request driven
1 parent 35d98b1 commit af1a003

10 files changed

+91
-403
lines changed

.github/workflows/code-scanning-pack-gen.yml

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,27 @@ on:
66
branches:
77
- main
88
- next
9+
- "rc/**"
910

1011
push:
1112
branches:
1213
- main
1314
- next
14-
15-
workflow_call:
16-
inputs:
17-
ref:
18-
description: |
19-
The ref to run the tests on.
20-
type: string
21-
required: true
15+
- "rc/**"
2216

2317
env:
2418
XARGS_MAX_PROCS: 4
2519

2620
jobs:
27-
determine-ref:
28-
runs-on: ubuntu-latest
29-
outputs:
30-
ref: ${{ steps.set-ref.outputs.ref }}
31-
env:
32-
REF_FROM_INPUT: ${{ inputs.ref }}
33-
EVENT_NAME: ${{ github.event_name }}
34-
steps:
35-
- id: set-ref
36-
run: |
37-
if [[ "$EVENT_NAME" == "workflow_dispatch" ]] || [[ "$EVENT_NAME" == "workflow_call" ]]; then
38-
echo "ref=$REF_FROM_INPUT" >> "$GITHUB_OUTPUT"
39-
else
40-
echo "ref=$GITHUB_REF" >> "$GITHUB_OUTPUT"
41-
fi
4221

4322
prepare-code-scanning-pack-matrix:
4423
name: Prepare CodeQL Code Scanning pack matrix
45-
needs: [determine-ref]
4624
runs-on: ubuntu-latest
4725
outputs:
4826
matrix: ${{ steps.export-code-scanning-pack-matrix.outputs.matrix }}
4927
steps:
5028
- name: Checkout repository
5129
uses: actions/checkout@v4
52-
with:
53-
ref: ${{ needs.determine-ref.outputs.ref }}
54-
5530
- name: Export Code Scanning pack matrix
5631
id: export-code-scanning-pack-matrix
5732
run: |
@@ -61,16 +36,14 @@ jobs:
6136
6237
create-code-scanning-pack:
6338
name: Create Code Scanning pack
64-
needs: [prepare-code-scanning-pack-matrix, determine-ref]
39+
needs: prepare-code-scanning-pack-matrix
6540
#runs-on: ubuntu-20.04-xl
6641
runs-on: ubuntu-latest
6742
strategy:
6843
fail-fast: false
6944
matrix: ${{ fromJSON(needs.prepare-code-scanning-pack-matrix.outputs.matrix) }}
7045
steps:
7146
- uses: actions/checkout@v4
72-
with:
73-
ref: ${{ needs.determine-ref.outputs.ref }}
7447

7548
- name: Cache CodeQL
7649
id: cache-codeql

.github/workflows/codeql_unit_tests.yml

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,23 @@ on:
66
branches:
77
- main
88
- next
9+
- "rc/**"
910
pull_request:
1011
branches:
1112
- main
1213
- next
13-
workflow_call:
14-
inputs:
15-
ref:
16-
description: |
17-
The ref to run the tests on.
18-
type: string
19-
required: true
14+
- "rc/**"
2015

2116
jobs:
22-
determine-ref:
23-
runs-on: ubuntu-latest
24-
outputs:
25-
ref: ${{ steps.set-ref.outputs.ref }}
26-
env:
27-
REF_FROM_INPUT: ${{ inputs.ref }}
28-
EVENT_NAME: ${{ github.event_name }}
29-
steps:
30-
- id: set-ref
31-
run: |
32-
if [[ "$EVENT_NAME" == "workflow_dispatch" ]] || [[ "$EVENT_NAME" == "workflow_call" ]]; then
33-
echo "ref=$REF_FROM_INPUT" >> "$GITHUB_OUTPUT"
34-
else
35-
echo "ref=$GITHUB_REF" >> "$GITHUB_OUTPUT"
36-
fi
37-
17+
3818
prepare-unit-test-matrix:
3919
name: Prepare CodeQL unit test matrix
40-
needs: [determine-ref]
4120
runs-on: ubuntu-latest
4221
outputs:
4322
matrix: ${{ steps.export-unit-test-matrix.outputs.matrix }}
4423
steps:
4524
- name: Checkout repository
4625
uses: actions/checkout@v4
47-
with:
48-
ref: ${{ needs.determine-ref.outputs.ref }}
4926

5027
- name: Export unit test matrix
5128
id: export-unit-test-matrix
@@ -58,7 +35,7 @@ jobs:
5835
5936
run-test-suites:
6037
name: Run unit tests
61-
needs: [prepare-unit-test-matrix, determine-ref]
38+
needs: prepare-unit-test-matrix
6239

6340
runs-on: ${{ matrix.os }}
6441
strategy:
@@ -68,8 +45,6 @@ jobs:
6845
steps:
6946
- name: Checkout repository
7047
uses: actions/checkout@v4
71-
with:
72-
ref: ${{ needs.determine-ref.outputs.ref }}
7348

7449
- name: Install Python
7550
uses: actions/setup-python@v4
@@ -184,7 +159,7 @@ jobs:
184159

185160
validate-test-results:
186161
name: Validate test results
187-
needs: [run-test-suites]
162+
needs: run-test-suites
188163
runs-on: ubuntu-latest
189164
steps:
190165
- name: Collect test results

.github/workflows/prepare-release.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,18 @@ jobs:
143143
git push
144144
145145
- name: Create release PR
146+
env:
147+
GITHUB_TOKEN: ${{ secrets.ACTION_DISPATCH_TOKEN }}
146148
if: env.create_release_pr == 'true'
147-
uses: peter-evans/create-pull-request@v5
148-
with:
149-
title: "Release v${{ inputs.version }}"
150-
body: "This PR releases codeql-coding-standards version ${{ inputs.version }}."
151-
commit-message: "Update user manual for release ${{ inputs.version }}."
152-
delete-branch: true
153-
branch: "rc/${{ inputs.version }}"
154-
149+
run: |
150+
gh pr create \
151+
-R $GITHUB_REPOSITORY \
152+
--title "Release v$RELEASE_VERSION" \
153+
--body "This PR releases codeql-coding-standards version $RELEASE_VERSION." \
154+
--base rc/$RELEASE_VERSION \
155+
--head feature/update-user-manual-for-$RELEASE_VERSION \
156+
--draft
157+
155158
- name: Determine pull request head SHA
156159
id: determine-pr-head-sha
157160
env:
@@ -162,14 +165,4 @@ jobs:
162165
echo "Release PR for rc/$RELEASE_VERSION is not open, but in state '$pr_state'. Cannot proceed!"
163166
exit 1
164167
fi
165-
echo "pull-request-head-sha=$pull_request_head_sha" >> "$GITHUB_OUTPUT"
166-
167-
# Invoke release validation because our PRs created with a GitHub token do not trigger a `pull_request` event.
168-
validate-release:
169-
name: "Validate coding standards release"
170-
needs: prepare-release
171-
uses: ./.github/workflows/validate-release.yml
172-
with:
173-
ref: ${{ needs.prepare-release.outputs.pull-request-head-sha }}
174-
secrets:
175-
release-engineering-token: ${{ secrets.RELEASE_ENGINEERING_TOKEN }}
168+
echo "pull-request-head-sha=$pull_request_head_sha" >> "$GITHUB_OUTPUT"

.github/workflows/update-release-status.yml

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- completed
66
- rerequested
77
branches:
8-
- "rc/*"
8+
- "rc/**"
99

1010
workflow_dispatch:
1111
inputs:
@@ -85,28 +85,38 @@ jobs:
8585
failed=$(echo "$status_stats" | jq -r '.failed')
8686
pending=$(echo "$status_stats" | jq -r '.pending')
8787
88-
if [[ "$pending" == "0" ]]; then
89-
echo "All check runs completed"
88+
echo "CHECK_RUNS_FAILED=$failed" >> "$GITHUB_ENV"
89+
echo "CHECK_RUNS_PENDING=$pending" >> "$GITHUB_ENV
9090
91-
if [[ "$failed" == "0" ]]; then
92-
echo "All check runs succeeded"
93-
conclusion="success"
94-
else
95-
echo "Some check runs failed"
96-
conclusion="failure"
97-
fi
91+
- name: Finalize release
92+
if: env.CHECK_RUNS_PENDING == '0' && env.CHECK_RUN_STATUS != 'completed'
93+
uses: ./.github/workflows/post-release.yml
94+
with:
95+
ref: ${{ env.CHECK_RUN_HEAD_SHA }}
9896

99-
jq -n \
100-
--arg status "completed" \
101-
--arg conclusion "$conclusion" \
102-
'{status: $status, conclusion: $conclusion}' \
103-
| \
104-
gh api \
105-
--method PATCH \
106-
--header "Accept: application/vnd.github+json" \
107-
--header "X-GitHub-Api-Version: 2022-11-28" \
108-
--input - \
109-
/repos/$GITHUB_REPOSITORY/check-runs/$CHECK_RUN_ID
97+
- name: Conclude release status
98+
if: env.CHECK_RUNS_PENDING == '0' && env.CHECK_RUN_STATUS != 'completed'
99+
env:
100+
GITHUB_TOKEN: ${{ github.token }}
101+
CHECK_RUNS_FAILED: ${{ env.check-runs-failed }}
102+
run: |
103+
if [[ "$CHECK_RUNS_FAILED" == "0" ]]; then
104+
echo "All check runs succeeded"
105+
conclusion="success"
110106
else
111-
echo "Not all check runs completed"
112-
fi
107+
echo "Some check runs failed"
108+
conclusion="failure"
109+
fi
110+
111+
jq -n \
112+
--arg status "completed" \
113+
--arg conclusion "$conclusion" \
114+
'{status: $status, conclusion: $conclusion}' \
115+
| \
116+
gh api \
117+
--method PATCH \
118+
--header "Accept: application/vnd.github+json" \
119+
--header "X-GitHub-Api-Version: 2022-11-28" \
120+
--input - \
121+
/repos/$GITHUB_REPOSITORY/check-runs/$CHECK_RUN_ID
122+

.github/workflows/validate-coding-standards.yml

Lines changed: 0 additions & 76 deletions
This file was deleted.

.github/workflows/validate-package-files.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
name: Validate Package Files
22
on:
3-
workflow_call:
4-
inputs:
5-
ref:
6-
description: 'The ref to validate. Defaults to the default branch.'
7-
required: true
8-
type: string
9-
workflow_dispatch:
10-
inputs:
11-
ref:
12-
description: 'The ref to validate. Defaults to the default branch.'
13-
required: true
14-
type: string
3+
merge_group:
4+
pull_request:
5+
branches:
6+
- main
7+
- next
8+
- "rc/**"
159

1610
jobs:
1711
validate-package-files:

0 commit comments

Comments
 (0)