Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically create branches that track the latest releases #3549

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/track-shipping-version.yml
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: 'shipping'
schmittjoseph marked this conversation as resolved.
Show resolved Hide resolved

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%-*}
schmittjoseph marked this conversation as resolved.
Show resolved Hide resolved
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"
schmittjoseph marked this conversation as resolved.
Show resolved Hide resolved
git push --force --set-upstream origin "HEAD:$shipping_branch_name"
schmittjoseph marked this conversation as resolved.
Show resolved Hide resolved