-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]> (cherry picked from commit f17bde4) Co-authored-by: Thomas Farr <[email protected]>
- Loading branch information
1 parent
87afb27
commit 97f3a48
Showing
2 changed files
with
76 additions
and
0 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,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
IFS='.' read -r -a VERSION_COMPONENTS <<< "$1" | ||
MAJOR="${VERSION_COMPONENTS[0]}" | ||
MINOR="${VERSION_COMPONENTS[1]}" | ||
PATCH="${VERSION_COMPONENTS[2]}" | ||
|
||
if [[ -z "$MAJOR" || -z "$MINOR" || -z "$PATCH" ]]; then | ||
echo "Usage: $0 <major>.<minor>.<patch>" | ||
exit 1 | ||
fi | ||
|
||
VERSION="$MAJOR.$MINOR.$PATCH" | ||
|
||
AUTO_LABEL_JSON=$(jq \ | ||
--arg v "$VERSION" \ | ||
'.rules |= with_entries(if .key | test("^v\\d+\\.\\d+\\.\\d+$") then .key |= "v\($v)" else . end)' \ | ||
.github/auto-label.json) | ||
echo "$AUTO_LABEL_JSON" > .github/auto-label.json | ||
|
||
GLOBAL_JSON=$(jq \ | ||
--arg v "$VERSION" \ | ||
--arg maj "$MAJOR" \ | ||
--arg min "$MINOR" \ | ||
'.version = "\($v)" | .doc_current = "\($maj).\($min)" | .doc_branch = "\($maj).x"' \ | ||
global.json) | ||
echo "$GLOBAL_JSON" > global.json | ||
|
||
sed -i '' -E "s/^([[:space:]]+VERSION: )([0-9]+\.){2}[0-9]+$/\1$VERSION/" .github/workflows/release.yml | ||
sed -i '' -E "s/(<Current(Assembly(File)?)?Version>)([0-9]+\.){2}[0-9]+<\//\1$VERSION<\//" Directory.Build.props |
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,44 @@ | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
branch: | ||
description: 'Branch to bump version on' | ||
required: true | ||
version: | ||
description: 'Version to bump to' | ||
required: true | ||
|
||
jobs: | ||
bump-version: | ||
name: Bump Version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: GitHub App Token | ||
id: github_app_token | ||
uses: tibdex/[email protected] | ||
with: | ||
app_id: ${{ secrets.APP_ID }} | ||
private_key: ${{ secrets.APP_PRIVATE_KEY }} | ||
installation_id: 22958780 | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.branch }} | ||
token: ${{ steps.github_app_token.outputs.token }} | ||
|
||
- name: Bump Version | ||
run: bash .github/bump-version.sh "${{ github.event.inputs.version }}" | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
token: ${{ steps.github_app_token.outputs.token }} | ||
base: ${{ github.event.inputs.branch }} | ||
branch: "feat/${{ github.event.inputs.branch }}/bump-version" | ||
commit-message: Bump version to ${{ github.event.inputs.version }} | ||
signoff: true | ||
delete-branch: true | ||
title: 'Bump version on ${{ github.event.inputs.branch }} to ${{ github.event.inputs.version }}.' | ||
body: | | ||
Bumping version on `${{ github.event.inputs.branch }}` to `${{ github.event.inputs.version }}`. | ||