Fix action command #2
Workflow file for this run
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
name: Release Automation | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
create-release-branches: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Git | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
- name: Create release branches | |
run: | | |
# Get the pushed tag | |
TAG=${GITHUB_REF#refs/tags/} | |
echo ${TAG} | |
# Extract major, minor, and patch versions | |
IFS='.' read -r MAJOR MINOR PATCH <<< "${TAG#v}" | |
echo ${MAJOR} | |
echo ${MINOR} | |
echo ${PATCH} | |
# Create release branch for the exact version | |
git checkout -b "release/${TAG}" | |
git push origin "release/${TAG}" | |
# Update release branch for minor version | |
git checkout -b "release/v${MAJOR}.${MINOR}" || git checkout "release/v${MAJOR}.${MINOR}" | |
git merge --ff-only "${TAG}" | |
git push origin "release/v${MAJOR}.${MINOR}" | |
# Update release branch for major version | |
git checkout -b "release/v${MAJOR}" || git checkout "release/v${MAJOR}" | |
git merge --ff-only "${TAG}" | |
git push origin "release/v${MAJOR}" |