Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
MuriloDalRi committed May 29, 2024
1 parent bf1942a commit 21922b9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/autorelease-rubygem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
id: fetch_default_branch_head
run: echo "sha=$(git ls-remote origin HEAD | cut -f 1)" >> "$GITHUB_OUTPUT"

- if: github.sha == steps.fetch_default_branch_head.outputs.sha
- if: github.sha != steps.fetch_default_branch_head.outputs.sha
name: "Auto-release rubygem"
env:
GEM_NAME: ${{ inputs.gem_name }}
Expand All @@ -38,9 +38,9 @@ jobs:
set -euo pipefail
curr_ver=$(ruby -r rubygems -e "puts Gem::Specification::load('$GEM_NAME.gemspec').version")
IFS=. read -ra ver_parts <<< "$curr_ver"
(( ver_parts[2]++ )) # Increment the patch version.
next_ver=$(printf "%d.%d.%d" "${ver_parts[@]}")
echo $curr_ver
next_ver=$(echo $curr_ver | cut -d . -f1).$(echo $curr_ver | cut -d . -f2).$(( $(echo $curr_ver | cut -d . -f3) + 1 ))
echo $next_ver
branch="release-$next_ver"
pr_title="Release v$next_ver"
pr_desc="This is an automated PR to bump the version number to $next_ver. This is a patch-level bump, as the only changes since v$curr_ver are dependency updates made by Dependabot."
Expand All @@ -62,7 +62,6 @@ jobs:
if [ "$(git log "v$curr_ver..main" --no-merges --format=format:%an | sort | uniq)" != "dependabot[bot]" ]; then
echo "Gem has no unreleased changes, or those changes include commits from users other than Dependabot. Exiting."
exit 0
fi
curr_ver_regex=$(printf "%d\\\.%d\\\.%d" "${ver_parts[@]}")
Expand All @@ -83,7 +82,7 @@ jobs:
gh pr create -H "$branch" --title "$pr_title" --body "$pr_desc"
- if: github.sha != steps.fetch_default_branch_head.outputs.sha
- if: github.sha == steps.fetch_default_branch_head.outputs.sha
name: "Skip release: commit is not HEAD of default branch"
run: |
echo "Skipping release because commit (${GITHUB_SHA}) isn't the HEAD of the default branch (${{ steps.fetch_default_branch_head.outputs.sha }})"

0 comments on commit 21922b9

Please sign in to comment.