-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically create branches that track the latest releases (#3549)
- Loading branch information
1 parent
19450df
commit 5621397
Showing
1 changed file
with
34 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,34 @@ | ||
on: | ||
release: | ||
types: [released] | ||
|
||
permissions: | ||
contents: write | ||
|
||
env: | ||
shipping_branch_prefix: 'shipped' | ||
|
||
jobs: | ||
update-shipping-branch: | ||
if: github.repository == 'dotnet/dotnet-monitor' | ||
name: '[${{ github.ref_name }}] Update shipping branch' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Update shipping branch | ||
run: | | ||
release_version=${GITHUB_REF_NAME%-*} | ||
if [[ ! "$release_version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
echo "Unexpected release tag: $release_version." | ||
exit 1 | ||
fi | ||
major_minor_version=${release_version%.*} | ||
shipping_branch_name="${{ env.shipping_branch_prefix }}/$major_minor_version" | ||
# This is a shallow clone so we will always create a new local branch even if it already exists on the remote | ||
git checkout -b "$shipping_branch_name" | ||
git push --force --set-upstream origin "HEAD:$shipping_branch_name" |