Skip to content

Commit

Permalink
Merge pull request #146 from TIBCOSoftware/feature/attempt-to-commit-…
Browse files Browse the repository at this point in the history
…release

chore: attempt to discover the default branch and commit
  • Loading branch information
Gerromie authored Mar 17, 2022
2 parents dddb0f2 + 5709c33 commit 76eb135
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,17 @@ jobs:
npm run release -- --release-as "${{ github.event.release.tag_name }}"
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
echo The default branch is "${DEFAULT_BRANCH}"
git remote set-head origin "${DEFAULT_BRANCH}"
if [ -z "${DEFAULT_BRANCH}" ]; then
DEFAULT_BRANCH='main'
lines=$(git branch -r | grep "${DEFAULT_BRANCH}" | wc -l | tr -d '[:space:]')
if [ "${lines}" == "0" ]; then
DEFAULT_BRANCH=master
fi
fi
echo The default branch was set to "${DEFAULT_BRANCH}"
echo Debug follows
git branch -r
echo End debug
git remote set-head origin "${DEFAULT_BRANCH}" || echo Could not set the origin reference
git push --follow-tags origin "${DEFAULT_BRANCH}"

0 comments on commit 76eb135

Please sign in to comment.