From 3fd5c503a0595b6ff242263432452b9c731e5417 Mon Sep 17 00:00:00 2001 From: rvermeulen Date: Tue, 12 Mar 2024 18:03:53 +0000 Subject: [PATCH 01/11] Update version --- c/cert/src/qlpack.yml | 2 +- c/cert/test/qlpack.yml | 2 +- c/common/src/qlpack.yml | 2 +- c/common/test/qlpack.yml | 2 +- c/misra/src/qlpack.yml | 2 +- c/misra/test/qlpack.yml | 2 +- cpp/autosar/src/qlpack.yml | 2 +- cpp/autosar/test/qlpack.yml | 2 +- cpp/cert/src/qlpack.yml | 2 +- cpp/cert/test/qlpack.yml | 2 +- cpp/common/src/qlpack.yml | 2 +- cpp/common/test/qlpack.yml | 2 +- cpp/misra/src/qlpack.yml | 2 +- cpp/misra/test/qlpack.yml | 2 +- cpp/report/src/qlpack.yml | 2 +- docs/user_manual.md | 12 ++++++------ 16 files changed, 21 insertions(+), 21 deletions(-) diff --git a/c/cert/src/qlpack.yml b/c/cert/src/qlpack.yml index d584e57d97..d308eae062 100644 --- a/c/cert/src/qlpack.yml +++ b/c/cert/src/qlpack.yml @@ -1,5 +1,5 @@ name: codeql/cert-c-coding-standards -version: 2.22.0-dev +version: 2.25.0 description: CERT C 2016 suites: codeql-suites license: MIT diff --git a/c/cert/test/qlpack.yml b/c/cert/test/qlpack.yml index fee5a2f16e..260e563511 100644 --- a/c/cert/test/qlpack.yml +++ b/c/cert/test/qlpack.yml @@ -1,5 +1,5 @@ name: codeql/cert-c-coding-standards-tests -version: 2.22.0-dev +version: 2.25.0 extractor: cpp license: MIT dependencies: diff --git a/c/common/src/qlpack.yml b/c/common/src/qlpack.yml index 75d0521b99..850461a8ed 100644 --- a/c/common/src/qlpack.yml +++ b/c/common/src/qlpack.yml @@ -1,5 +1,5 @@ name: codeql/common-c-coding-standards -version: 2.22.0-dev +version: 2.25.0 license: MIT dependencies: codeql/common-cpp-coding-standards: '*' diff --git a/c/common/test/qlpack.yml b/c/common/test/qlpack.yml index 9c82dfd3dd..fbf8de2a52 100644 --- a/c/common/test/qlpack.yml +++ b/c/common/test/qlpack.yml @@ -1,5 +1,5 @@ name: codeql/common-c-coding-standards-tests -version: 2.22.0-dev +version: 2.25.0 extractor: cpp license: MIT dependencies: diff --git a/c/misra/src/qlpack.yml b/c/misra/src/qlpack.yml index 45a668f52c..71ac5d0fe7 100644 --- a/c/misra/src/qlpack.yml +++ b/c/misra/src/qlpack.yml @@ -1,5 +1,5 @@ name: codeql/misra-c-coding-standards -version: 2.22.0-dev +version: 2.25.0 description: MISRA C 2012 suites: codeql-suites license: MIT diff --git a/c/misra/test/qlpack.yml b/c/misra/test/qlpack.yml index b64a6fb167..953afa3424 100644 --- a/c/misra/test/qlpack.yml +++ b/c/misra/test/qlpack.yml @@ -1,5 +1,5 @@ name: codeql/misra-c-coding-standards-tests -version: 2.22.0-dev +version: 2.25.0 extractor: cpp license: MIT dependencies: diff --git a/cpp/autosar/src/qlpack.yml b/cpp/autosar/src/qlpack.yml index 356285a5b9..bbe5a9e2c3 100644 --- a/cpp/autosar/src/qlpack.yml +++ b/cpp/autosar/src/qlpack.yml @@ -1,5 +1,5 @@ name: codeql/autosar-cpp-coding-standards -version: 2.22.0-dev +version: 2.25.0 description: AUTOSAR C++14 Guidelines R22-11, R21-11, R20-11, R19-11 and R19-03 suites: codeql-suites license: MIT diff --git a/cpp/autosar/test/qlpack.yml b/cpp/autosar/test/qlpack.yml index 062c269f5e..b9acbdcb30 100644 --- a/cpp/autosar/test/qlpack.yml +++ b/cpp/autosar/test/qlpack.yml @@ -1,5 +1,5 @@ name: codeql/autosar-cpp-coding-standards-tests -version: 2.22.0-dev +version: 2.25.0 extractor: cpp license: MIT dependencies: diff --git a/cpp/cert/src/qlpack.yml b/cpp/cert/src/qlpack.yml index a73ff2fd41..af3b5bc843 100644 --- a/cpp/cert/src/qlpack.yml +++ b/cpp/cert/src/qlpack.yml @@ -1,5 +1,5 @@ name: codeql/cert-cpp-coding-standards -version: 2.22.0-dev +version: 2.25.0 description: CERT C++ 2016 suites: codeql-suites license: MIT diff --git a/cpp/cert/test/qlpack.yml b/cpp/cert/test/qlpack.yml index 2c879e82a2..2b7186a1ad 100644 --- a/cpp/cert/test/qlpack.yml +++ b/cpp/cert/test/qlpack.yml @@ -1,5 +1,5 @@ name: codeql/cert-cpp-coding-standards-tests -version: 2.22.0-dev +version: 2.25.0 extractor: cpp license: MIT dependencies: diff --git a/cpp/common/src/qlpack.yml b/cpp/common/src/qlpack.yml index bb698cc9b0..274ab35914 100644 --- a/cpp/common/src/qlpack.yml +++ b/cpp/common/src/qlpack.yml @@ -1,5 +1,5 @@ name: codeql/common-cpp-coding-standards -version: 2.22.0-dev +version: 2.25.0 license: MIT dependencies: codeql/cpp-all: 0.9.3 diff --git a/cpp/common/test/qlpack.yml b/cpp/common/test/qlpack.yml index 5a5374e947..00958ab22e 100644 --- a/cpp/common/test/qlpack.yml +++ b/cpp/common/test/qlpack.yml @@ -1,5 +1,5 @@ name: codeql/common-cpp-coding-standards-tests -version: 2.22.0-dev +version: 2.25.0 extractor: cpp license: MIT dependencies: diff --git a/cpp/misra/src/qlpack.yml b/cpp/misra/src/qlpack.yml index b5dc482483..71a37e030b 100644 --- a/cpp/misra/src/qlpack.yml +++ b/cpp/misra/src/qlpack.yml @@ -1,5 +1,5 @@ name: codeql/misra-cpp-coding-standards -version: 2.22.0-dev +version: 2.25.0 description: MISRA C++ 2008 suites: codeql-suites license: MIT diff --git a/cpp/misra/test/qlpack.yml b/cpp/misra/test/qlpack.yml index f8b7339f66..f764a49487 100644 --- a/cpp/misra/test/qlpack.yml +++ b/cpp/misra/test/qlpack.yml @@ -1,5 +1,5 @@ name: codeql/misra-cpp-coding-standards-tests -version: 2.22.0-dev +version: 2.25.0 extractor: cpp license: MIT dependencies: diff --git a/cpp/report/src/qlpack.yml b/cpp/report/src/qlpack.yml index 7acfe4cf12..3c93eb73cb 100644 --- a/cpp/report/src/qlpack.yml +++ b/cpp/report/src/qlpack.yml @@ -1,5 +1,5 @@ name: codeql/report-cpp-coding-standards -version: 2.22.0-dev +version: 2.25.0 license: MIT dependencies: codeql/cpp-all: 0.9.3 diff --git a/docs/user_manual.md b/docs/user_manual.md index af050c07e2..09693e8643 100644 --- a/docs/user_manual.md +++ b/docs/user_manual.md @@ -29,13 +29,13 @@ ## Release information -This user manual documents release `2.22.0-dev` of the coding standards located at [https://github.com/github/codeql-coding-standards](https://github.com/github/codeql-coding-standards). +This user manual documents release `2.25.0` of the coding standards located at [https://github.com/github/codeql-coding-standards](https://github.com/github/codeql-coding-standards). The release page documents the release notes and contains the following artifacts part of the release: -- `code-scanning-cpp-query-pack-2.22.0-dev.zip`: coding standard queries and scripts to be used with GitHub Code Scanning or the CodeQL CLI as documented in the section _Operating manual_. -- `supported_rules_list_2.22.0-dev.csv`: A Comma Separated File (CSV) containing the supported rules per standard and the queries that implement the rule. -- `supported_rules_list_2.22.0-dev.md`: A Markdown formatted file with a table containing the supported rules per standard and the queries that implement the rule. -- `user_manual_2.22.0-dev.md`: This user manual. +- `code-scanning-cpp-query-pack-2.25.0.zip`: coding standard queries and scripts to be used with GitHub Code Scanning or the CodeQL CLI as documented in the section _Operating manual_. +- `supported_rules_list_2.25.0.csv`: A Comma Separated File (CSV) containing the supported rules per standard and the queries that implement the rule. +- `supported_rules_list_2.25.0.md`: A Markdown formatted file with a table containing the supported rules per standard and the queries that implement the rule. +- `user_manual_2.25.0.md`: This user manual. - `Source Code (zip)`: A zip archive containing the contents of https://github.com/github/codeql-coding-standards - `Source Code (tar.gz)`: A GZip compressed tar archive containing the contents of https://github.com/github/codeql-coding-standards - `checksums.txt`: A text file containing sha256 checksums for the aforementioned artifacts. @@ -496,7 +496,7 @@ This section describes known failure modes for "CodeQL Coding Standards" and des | | Ouf of space | Less output. Some files may be only be partially analyzed, or not analyzed at all. | Error reported on the command line. | Increase space. If it remains an issue report space consumption issues via the CodeQL Coding Standards [bug tracker](https://github.com/github/codeql-coding-standards/issues). | | | False positives | More output. Results are reported which are not violations of the guidelines. | All reported results must be reviewed. | Report false positive issues via the CodeQL Coding Standards [bug tracker](https://github.com/github/codeql-coding-standards/issues). | | | False negatives | Less output. Violations of the guidelines are not reported. | Other validation and verification processes during software development should be used to complement the analysis performed by CodeQL Coding Standards. | Report false negative issues via the CodeQL Coding Standards [bug tracker](https://github.com/github/codeql-coding-standards/issues). | -| | Modifying coding standard suite | More or less output. If queries are added to the query set more result can be reported. If queries are removed less results might be reported. | All queries supported by the CodeQL Coding Standards are listed in the release artifacts `supported_rules_list_2.22.0-dev.csv` where VERSION is replaced with the used release. The rules in the resulting Sarif file must be cross-referenced with the expected rules in this list to determine the validity of the used CodeQL suite. | Ensure that the CodeQL Coding Standards are not modified in ways that are not documented as supported modifications. | +| | Modifying coding standard suite | More or less output. If queries are added to the query set more result can be reported. If queries are removed less results might be reported. | All queries supported by the CodeQL Coding Standards are listed in the release artifacts `supported_rules_list_2.25.0.csv` where VERSION is replaced with the used release. The rules in the resulting Sarif file must be cross-referenced with the expected rules in this list to determine the validity of the used CodeQL suite. | Ensure that the CodeQL Coding Standards are not modified in ways that are not documented as supported modifications. | | | Incorrect deviation record specification | More output. Results are reported for guidelines for which a deviation is assigned. | Analysis integrity report lists all deviations and incorrectly specified deviation records with a reason. Ensure that all deviation records are correctly specified. | Ensure that the deviation record is specified according to the specification in the user manual. | | | Incorrect deviation permit specification | More output. Results are reported for guidelines for which a deviation is assigned. | Analysis integrity report lists all deviations and incorrectly specified deviation permits with a reason. Ensure that all deviation permits are correctly specified. | Ensure that the deviation record is specified according to the specification in the user manual. | | | Unapproved use of a deviation record | Less output. Results for guideline violations are not reported. | Validate that the deviation record use is approved by verifying the approved-by attribute of the deviation record specification. | Ensure that each raised deviation record is approved by an independent approver through an auditable process. | From f3bb3015cfc26af023332028422d9f5520a14c97 Mon Sep 17 00:00:00 2001 From: Remco Vermeulen Date: Tue, 12 Mar 2024 17:13:00 -0700 Subject: [PATCH 02/11] Checkout head sha for the correct local files --- .github/workflows/update-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-release.yml b/.github/workflows/update-release.yml index 67666bbf39..912d5aa429 100644 --- a/.github/workflows/update-release.yml +++ b/.github/workflows/update-release.yml @@ -31,6 +31,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 # We need the full history to compute the changelog + ref: ${{ inputs.head-sha }} - name: Install Python uses: actions/setup-python@v4 From 229e79188ccafc4121691e7ea43bca49040057a1 Mon Sep 17 00:00:00 2001 From: Remco Vermeulen Date: Tue, 12 Mar 2024 21:51:59 -0700 Subject: [PATCH 03/11] Exclude checkrun for Update Release This allows us to re-run it manually in case of an error. --- .github/workflows/update-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-release.yml b/.github/workflows/update-release.yml index 912d5aa429..21838c1d9f 100644 --- a/.github/workflows/update-release.yml +++ b/.github/workflows/update-release.yml @@ -60,7 +60,7 @@ jobs: --layout scripts/release/release-layout.yml \ --repo "$GITHUB_REPOSITORY" \ --github-token "$GITHUB_REPOSITORY:$GITHUB_TOKEN" "github/codeql-coding-standards-release-engineering:$RELEASE_ENGINEERING_TOKEN" \ - --skip-checkrun "release-status" + --skip-checkrun "release-status" "Update Release" - name: Update release notes env: From 72ec5876b4d24fb83d4a7b9e79b16d7b2c7e363c Mon Sep 17 00:00:00 2001 From: Remco Vermeulen Date: Tue, 12 Mar 2024 22:13:41 -0700 Subject: [PATCH 04/11] Invoke correct hot-fix check script --- .github/workflows/finalize-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/finalize-release.yml b/.github/workflows/finalize-release.yml index fbadfdb836..7329ceb9d2 100644 --- a/.github/workflows/finalize-release.yml +++ b/.github/workflows/finalize-release.yml @@ -61,7 +61,7 @@ jobs: - name: Determine if release was a hotfix release run: | version=${BASE_REF#rc/} - echo "HOTFIX_RELEASE=$(python scripts/release/is-hotfix.py $version)" >> "$GITHUB_ENV" + echo "HOTFIX_RELEASE=$(python scripts/release/is-hotfix-release.py $version)" >> "$GITHUB_ENV" - name: Bump main version if: env.HOTFIX_RELEASE == 'false' From 880092b6588d7c8ade0c4e87938327c5a069b5d5 Mon Sep 17 00:00:00 2001 From: Remco Vermeulen Date: Tue, 12 Mar 2024 22:21:07 -0700 Subject: [PATCH 05/11] Setup Python and install script dependencies --- .github/workflows/finalize-release.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/finalize-release.yml b/.github/workflows/finalize-release.yml index 7329ceb9d2..de687ee153 100644 --- a/.github/workflows/finalize-release.yml +++ b/.github/workflows/finalize-release.yml @@ -35,6 +35,14 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ env.REF }} + + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: "3.9" + + - name: Install dependencies + run: pip install -r scripts/release/requirements.txt - name: Configure git run: | From 47837fd11496d275fc776bf314559098abf75629 Mon Sep 17 00:00:00 2001 From: Remco Vermeulen Date: Tue, 12 Mar 2024 22:28:31 -0700 Subject: [PATCH 06/11] Add reason to get merge base failure message --- scripts/release/is-hotfix-release.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release/is-hotfix-release.py b/scripts/release/is-hotfix-release.py index a496b63c27..aba957ea5f 100644 --- a/scripts/release/is-hotfix-release.py +++ b/scripts/release/is-hotfix-release.py @@ -9,7 +9,7 @@ def get_merge_base_of_ref() -> str: cp = run(["git", "merge-base", "HEAD", "origin/main"], capture_output=True, text=True) if cp.returncode != 0: - raise RuntimeError("Failed to get merge base") + raise RuntimeError(f"Failed to get merge base with reason '{cp.stderr.strip()}'") return cp.stdout.strip() def get_release_branches_containing(commit: str) -> List[Version]: From 9b64f0e6f3f0e85461a52204b3c05f5599022f8b Mon Sep 17 00:00:00 2001 From: Remco Vermeulen Date: Wed, 13 Mar 2024 08:47:09 -0700 Subject: [PATCH 07/11] Increase fetch depth to test merge base logic --- .github/workflows/finalize-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/finalize-release.yml b/.github/workflows/finalize-release.yml index de687ee153..89a24a3ae6 100644 --- a/.github/workflows/finalize-release.yml +++ b/.github/workflows/finalize-release.yml @@ -35,6 +35,7 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ env.REF }} + fetch-depth: 0 - name: Install Python uses: actions/setup-python@v4 From c90927b7e440e0bc15f5d84cbe4b9dfd535df880 Mon Sep 17 00:00:00 2001 From: Remco Vermeulen Date: Thu, 14 Mar 2024 16:09:32 -0700 Subject: [PATCH 08/11] Force creation of release tag To prevent failure of the whole workflow when a tag already exists, we force the creation. --- .github/workflows/finalize-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/finalize-release.yml b/.github/workflows/finalize-release.yml index 89a24a3ae6..fc216d3ee0 100644 --- a/.github/workflows/finalize-release.yml +++ b/.github/workflows/finalize-release.yml @@ -55,8 +55,8 @@ jobs: version=${BASE_REF#rc/} echo "Creating release tag v$version" - git tag -a v$version -m "Release v$version" - git push -f origin v$version + git tag -f -a v$version -m "Release v$version" + git push --force-with-lease origin v$version - name: Finalize release env: From 8c8a2e2555bd7782ac087b68114cc82391402418 Mon Sep 17 00:00:00 2001 From: Remco Vermeulen Date: Thu, 14 Mar 2024 16:42:20 -0700 Subject: [PATCH 09/11] Bump to the correct next semantic version --- .github/workflows/finalize-release.yml | 2 +- scripts/release/next-version.py | 28 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 scripts/release/next-version.py diff --git a/.github/workflows/finalize-release.yml b/.github/workflows/finalize-release.yml index fc216d3ee0..5c5ce04a29 100644 --- a/.github/workflows/finalize-release.yml +++ b/.github/workflows/finalize-release.yml @@ -78,7 +78,7 @@ jobs: GH_TOKEN: ${{ github.token }} run: | version=${BASE_REF#rc/} - next_version="$version-dev" + next_version=$(python scripts/release/next-version.py --component minor --pre-release dev -- $version) echo "Bumping main version to $next_version" git switch main diff --git a/scripts/release/next-version.py b/scripts/release/next-version.py new file mode 100644 index 0000000000..548371f0d9 --- /dev/null +++ b/scripts/release/next-version.py @@ -0,0 +1,28 @@ +from semantic_version import Version +import argparse + +parser = argparse.ArgumentParser(description='Prints the next release version') +parser.add_argument('-c', '--component', default="minor", help='The component to increment (major, minor, patch)') +parser.add_argument('-p', '--pre-release', nargs='*', help='The pre-release label(s) (e.g. alpha, dev). Multiple labels can be specified so separate the options and the version using `--`!') +parser.add_argument('-b', '--build', nargs='*', help='The build identifier(s). Multiple identifiers can be specified so separate the options and the version using `--`!') +parser.add_argument('current_version', type=Version, help='The current version') + +if __name__ == "__main__": + args = parser.parse_args() + version : Version = args.current_version + next_version = None + if args.component== "major": + next_version = version.next_major() + elif args.component == "minor": + next_version = version.next_minor() + elif args.component == "patch": + next_version = version.next_patch() + else: + raise ValueError(f"Invalid release type: {args.release_type}") + + if args.pre_release: + next_version.prerelease = args.pre_release + if args.build: + next_version.build = args.build + + print(next_version) \ No newline at end of file From 759de8254bc4a09f8ef0fd55379fd361818034aa Mon Sep 17 00:00:00 2001 From: Remco Vermeulen Date: Thu, 14 Mar 2024 16:47:23 -0700 Subject: [PATCH 10/11] Force push tag --- .github/workflows/finalize-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/finalize-release.yml b/.github/workflows/finalize-release.yml index 5c5ce04a29..e5b8d15b64 100644 --- a/.github/workflows/finalize-release.yml +++ b/.github/workflows/finalize-release.yml @@ -56,7 +56,7 @@ jobs: echo "Creating release tag v$version" git tag -f -a v$version -m "Release v$version" - git push --force-with-lease origin v$version + git push --force origin v$version - name: Finalize release env: From 486000ea7a4645373adb54d81b167bdd3e7075cb Mon Sep 17 00:00:00 2001 From: Remco Vermeulen Date: Thu, 14 Mar 2024 17:31:05 -0700 Subject: [PATCH 11/11] Add support for running tools from different ref When you manually have to run this workflow updates to the tooling cannot be used without updating the release branch. To workaround this, we support a split between the release on which we act and the tooling we use. --- .github/workflows/finalize-release.yml | 45 ++++++++++++++++++++------ 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/.github/workflows/finalize-release.yml b/.github/workflows/finalize-release.yml index e5b8d15b64..ca91b249f5 100644 --- a/.github/workflows/finalize-release.yml +++ b/.github/workflows/finalize-release.yml @@ -9,8 +9,12 @@ on: inputs: ref: description: | - The release branch to finalize. + The ref of release to finalize (e.g., 'rc/MAJOR.MINOR.PATCH'). required: true + tool-ref: + description: | + The ref to the tooling to use for the finalize (e.g., 'rc/MAJOR.MINOR.PATCH'). + required: false jobs: finalize-release: @@ -20,14 +24,17 @@ jobs: - name: Determine ref env: REF_FROM_INPUT: ${{ inputs.ref }} + TOOL_REF_FROM_INPUT: ${{ inputs.tool-ref }} REF_FROM_PR: ${{ github.event.pull_request.merge_commit_sha }} BASE_REF_FROM_PR: ${{ github.event.pull_request.base.ref }} run: | if [[ $GITHUB_EVENT_NAME == "workflow_dispatch" ]]; then echo "REF=$REF_FROM_INPUT" >> "$GITHUB_ENV" + echo "TOOL_REF=$TOOL_REF_FROM_INPUT" >> "$GITHUB_ENV" echo "BASE_REF=$REF_FROM_INPUT" >> "$GITHUB_ENV" else echo "REF=$REF_FROM_PR" >> "$GITHUB_ENV" + echo "TOOL_REF=$REF_FROM_PR" >> "$GITHUB_ENV" echo "BASE_REF=$BASE_REF_FROM_PR" >> "$GITHUB_ENV" fi @@ -36,6 +43,13 @@ jobs: with: ref: ${{ env.REF }} fetch-depth: 0 + path: release + + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ env.TOOL_REF }} + path: tooling - name: Install Python uses: actions/setup-python@v4 @@ -44,11 +58,13 @@ jobs: - name: Install dependencies run: pip install -r scripts/release/requirements.txt + working-directory: tooling - name: Configure git run: | git config user.name "$GITHUB_ACTOR" git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + working-directory: release - name: Update release tag run: | @@ -57,6 +73,7 @@ jobs: git tag -f -a v$version -m "Release v$version" git push --force origin v$version + working-directory: release - name: Finalize release env: @@ -66,30 +83,40 @@ jobs: echo "Finalizing release v$version" gh release edit "v$version" --draft=false --tag=v$version + working-directory: release - name: Determine if release was a hotfix release run: | version=${BASE_REF#rc/} - echo "HOTFIX_RELEASE=$(python scripts/release/is-hotfix-release.py $version)" >> "$GITHUB_ENV" + # We are running the script in the tooling directory with the release directory as the working directory + echo "HOTFIX_RELEASE=$(python ../tooling/scripts/release/is-hotfix-release.py $version)" >> "$GITHUB_ENV" + working-directory: release + + - name: Determine next release version + if: env.HOTFIX_RELEASE == 'false' + run: | + version=${BASE_REF#rc/} + next_version=$(python scripts/release/next-version.py --component minor --pre-release dev -- $version) + echo "NEXT_VERSION=$next_version" >> "$GITHUB_ENV" + working-directory: tooling - name: Bump main version - if: env.HOTFIX_RELEASE == 'false' env: GH_TOKEN: ${{ github.token }} run: | - version=${BASE_REF#rc/} - next_version=$(python scripts/release/next-version.py --component minor --pre-release dev -- $version) - echo "Bumping main version to $next_version" + echo "Bumping main version to $NEXT_VERSION" git switch main git pull --ff-only origin main git switch -c release-automation/bump-version - ./scripts/release/bump-version.sh "$next_version" + # We are running the script in the tooling directory with the release directory as the working directory + ../tooling/scripts/release/bump-version.sh "$NEXT_VERSION" git add -u . - git commit -m "Bump version to $next_version" + git commit -m "Bump version to $NEXT_VERSION" git push --set-upstream origin release-automation/bump-version - gh pr create --repo $GITHUB_REPOSITORY --base main --head release-automation/bump-version --body "Bump the version of main to the dev label of the just released version $next_version" --title "Bump version to $next_version" + gh pr create --repo $GITHUB_REPOSITORY --base main --head release-automation/bump-version --body "Bump the version of main to $NEXT_VERSION" --title "Bump version to $NEXT_VERSION" + working-directory: release