-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2014 from github/nickfyson/update-release-process
update release process to support multiple version
- Loading branch information
Showing
56 changed files
with
438 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import argparse | ||
import json | ||
import os | ||
import subprocess | ||
|
||
# Name of the remote | ||
ORIGIN = 'origin' | ||
|
||
OLDEST_SUPPORTED_MAJOR_VERSION = 2 | ||
|
||
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v4 | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.