Skip to content

Commit

Permalink
Merge branch 'main' into henrymercer/drop-codeql-v2.11.5
Browse files Browse the repository at this point in the history
  • Loading branch information
henrymercer committed Jan 2, 2024
2 parents 5dc8134 + ee9b8ab commit 35b10b5
Show file tree
Hide file tree
Showing 619 changed files with 69,085 additions and 7,380 deletions.
2 changes: 1 addition & 1 deletion .github/actions/check-sarif/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ inputs:
Comma separated list of query ids that should NOT be included in this SARIF file.
runs:
using: node16
using: node20
main: index.js
25 changes: 25 additions & 0 deletions .github/actions/release-branches/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'Release branches'
description: 'Determine branches for release & backport'
inputs:
major_version:
description: 'The version as extracted from the package.json file'
required: true
latest_tag:
description: 'The most recent tag published to the repository'
required: true
outputs:
backport_source_branch:
description: "The release branch for the given tag"
value: ${{ steps.branches.outputs.backport_source_branch }}
backport_target_branches:
description: "JSON encoded list of branches to target with backports"
value: ${{ steps.branches.outputs.backport_target_branches }}
runs:
using: "composite"
steps:
- id: branches
run: |
python ${{ github.action_path }}/release-branches.py \
--major-version ${{ inputs.major_version }} \
--latest-tag ${{ inputs.latest_tag }}
shell: bash
55 changes: 55 additions & 0 deletions .github/actions/release-branches/release-branches.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import argparse
import json
import os
import configparser

# Name of the remote
ORIGIN = 'origin'

script_dir = os.path.dirname(os.path.realpath(__file__))
grandparent_dir = os.path.dirname(os.path.dirname(script_dir))

config = configparser.ConfigParser()
with open(os.path.join(grandparent_dir, 'releases.ini')) as stream:
config.read_string('[default]\n' + stream.read())

OLDEST_SUPPORTED_MAJOR_VERSION = int(config['default']['OLDEST_SUPPORTED_MAJOR_VERSION'])

def main():

parser = argparse.ArgumentParser()
parser.add_argument("--major-version", required=True, type=str, help="The major version of the release")
parser.add_argument("--latest-tag", required=True, type=str, help="The most recent tag published to the repository")
args = parser.parse_args()

major_version = args.major_version
latest_tag = args.latest_tag

print("major_version: " + major_version)
print("latest_tag: " + latest_tag)

# If this is a primary release, we backport to all supported branches,
# so we check whether the major_version taken from the package.json
# is greater than or equal to the latest tag pulled from the repo.
# For example...
# 'v1' >= 'v2' is False # we're operating from an older release branch and should not backport
# 'v2' >= 'v2' is True # the normal case where we're updating the current version
# 'v3' >= 'v2' is True # in this case we are making the first release of a new major version
consider_backports = ( major_version >= latest_tag.split(".")[0] )

with open(os.environ["GITHUB_OUTPUT"], "a") as f:

f.write(f"backport_source_branch=releases/{major_version}\n")

backport_target_branches = []

if consider_backports:
for i in range(int(major_version.strip("v"))-1, 0, -1):
branch_name = f"releases/v{i}"
if i >= OLDEST_SUPPORTED_MAJOR_VERSION:
backport_target_branches.append(branch_name)

f.write("backport_target_branches="+json.dumps(backport_target_branches)+"\n")

if __name__ == "__main__":
main()
33 changes: 33 additions & 0 deletions .github/actions/release-initialise/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'Prepare release job'
description: 'Prepare for updating a release branch'

runs:
using: "composite"
steps:

- name: Dump environment
run: env
shell: bash

- name: Dump GitHub context
env:
GITHUB_CONTEXT: '${{ toJson(github) }}'
run: echo "$GITHUB_CONTEXT"
shell: bash

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install PyGithub==1.55 requests
shell: bash

- name: Update git config
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
shell: bash
1 change: 1 addition & 0 deletions .github/releases.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OLDEST_SUPPORTED_MAJOR_VERSION=2

0 comments on commit 35b10b5

Please sign in to comment.