Automated release: v5.2.4 released. Cutting the branch for the next version #1
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: "Automated Release: Create next release branch" | ||
on: | ||
release: | ||
types: [released] | ||
env: | ||
VERSION_REGEX: ^v\d+\.\d+\.\d+$ | ||
run-name: "Automated release: ${{ github.event.release.tag_name }} released. Cutting the branch for the next version" | ||
jobs: | ||
create-next-release-branch: | ||
name: Parse PRs labels and create next release branch | ||
runs-on: ubuntu-latest | ||
outputs: | ||
new_branch: ${{ steps.get-next-version.outputs[steps.get_increment_type.outputs.increment_type] }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: master | ||
- name: Get default branch sha | ||
id: get_sha | ||
run: | | ||
BASE_SHA=$(git rev-parse master) | ||
echo "BASE_SHA=$BASE_SHA" >> $GITHUB_ENV | ||
echo "Release branch will be cut from master at $BASE_SHA" | ||
- name: Get latest released tag | ||
id: latest_tag | ||
uses: oprypin/find-latest-tag@v1 | ||
with: | ||
repository: ${{ github.repository }} | ||
regex: ${{ env.VERSION_REGEX }} | ||
sort-tags: true | ||
releases-only: true | ||
- name: Get PRs between master (${{ env.BASE_SHA }}) and ${{ steps.latest_tag.outputs.tag }} | ||
uses: VanOns/get-merged-pull-requests-action@master | ||
id: pull_requests | ||
with: | ||
github_token: ${{ github.token }} | ||
current_tag: ${{ env.BASE_SHA }} | ||
previous_tag: ${{ steps.latest_tag.outputs.tag }} | ||
return_type: "all" | ||
- name: Get labels of PRs and determine increment type | ||
id: get_increment_type | ||
env: | ||
PULL_REQUESTS: ${{ steps.pull_requests.outputs.pull_requests }} | ||
MAJOR_LABEL: major | ||
MINOR_LABEL: minor | ||
PATCH_LABEL: patch | ||
run: | | ||
if [ -z "$PULL_REQUESTS" ]; then | ||
echo "Error: No PRs found between branches" && exit 1 | ||
fi | ||
labels=$(echo "$PULL_REQUESTS" | jq -r '.[].labels[].name') | ||
echo Labels: $labels | ||
increment_type="patch" | ||
case "$labels" in | ||
*"${{ env.MAJOR_LABEL }}"*) increment_type="major"; echo "Major changes found! Should increase major version." ;; | ||
*"${{ env.MINOR_LABEL }}"*) increment_type="minor"; echo "Minor changes found! Should increase minor version." ;; | ||
*"${{ env.PATCH_LABEL }}"*) echo "Patch changes found! Should increase patch version." ;; | ||
*) echo "No PRs labeled patch, minor or major found! Defaulting to 'patch'." ;; | ||
esac | ||
echo "increment_type=$increment_type" >> $GITHUB_OUTPUT | ||
- name: Calculate next version. Increment type - ${{ steps.get_increment_type.outputs.increment_type }} | ||
id: get-next-version | ||
uses: WyriHaximus/[email protected] | ||
with: | ||
version: ${{ steps.latest_tag.outputs.tag }} | ||
- name: Create branch ${{ steps.get-next-version.outputs[steps.get_increment_type.outputs.increment_type] }} from ${{ env.BASE_SHA }} | ||
uses: peterjgrainger/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
branch: ${{ steps.get-next-version.outputs[steps.get_increment_type.outputs.increment_type] }} | ||
sha: ${{ env.BASE_SHA }} | ||
rc_release: | ||
Check failure on line 82 in .github/workflows/automated_release.create_release_branch.yml
|
||
name: Tag and Release version ${{ needs.create-next-release-branch.outputs.new_branch }}rc0 from branch ${{ needs.create-next-release-branch.outputs.new_branch }} | ||
uses: ./.github/workflows/tag.yml | ||
needs: create-next-release-branch | ||
with: | ||
version: ${{ needs.create-next-release-branch.outputs.new_branch }}rc0 | ||
from_branch: ${{ needs.create-next-release-branch.outputs.new_branch }} |