Skip to content

Commit

Permalink
Automatically create branches that track the latest releases (#3549)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmittjoseph authored Feb 3, 2023
1 parent 19450df commit 5621397
Showing 1 changed file with 34 additions and 0 deletions.
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: '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"

0 comments on commit 5621397

Please sign in to comment.