Skip to content

Commit

Permalink
Implement Error Handling and Additions for Github Action (#3652)
Browse files Browse the repository at this point in the history
**What does this PR do?** A clear and concise description with your
runway ticket url.


**Screenshots:** Screenshots to visualize your addition/change


**How to test?** Steps to confirm the desired behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See addition/change


#### Checklist:
- [ ] **LABELS** Add a label: `enhancement`, `bug`, `improvement`, `new
kit`, `deprecated`, or `breaking`. See [Changelog &
Labels](https://github.com/powerhome/playbook/wiki/Changelog-&-Labels)
for details.
- [ ] **DEPLOY** I have added the `milano` label to show I'm ready for a
review.
- [ ] **TESTS** I have added test coverage to my code.
  • Loading branch information
jasperfurniss authored Sep 4, 2024
1 parent 80fe0e0 commit 77322df
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/github-actions-release-candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,24 @@ jobs:
echo "new_ruby_version=${new_ruby_version}" >> $GITHUB_ENV
- name: Check if version exists and increment if necessary
run: |
while npm view playbook-ui@${{ env.new_npm_version }} version &>/dev/null; do
new_npm_version=$(yarn version --prerelease --preid rc --no-git-tag-version | grep "New version:" | awk '{print $4}')
new_npm_version=${new_npm_version#v}
echo "new_npm_version=${new_npm_version}" >> $GITHUB_ENV
max_attempts=2
attempt=0
while [ $attempt -lt $max_attempts ]; do
if timeout 30s npm view playbook-ui@${{ env.new_npm_version }} version &>/dev/null; then
echo "Version ${{ env.new_npm_version }} already exists. Incrementing..."
new_npm_version=$(yarn version --prerelease --preid rc --no-git-tag-version | grep "New version:" | awk '{print $4}')
new_npm_version=${new_npm_version#v}
echo "new_npm_version=${new_npm_version}" >> $GITHUB_ENV
else
echo "Version ${{ env.new_npm_version }} is available."
break
fi
attempt=$((attempt+1))
done
if [ $attempt -eq $max_attempts ]; then
echo "Error: Maximum attempts reached. Unable to find an available version."
exit 1
fi
new_ruby_version=$(echo $new_npm_version | sed 's/-rc\./.pre.rc./')
echo "new_ruby_version=${new_ruby_version}" >> $GITHUB_ENV
- name: Update Version.rb
Expand Down

0 comments on commit 77322df

Please sign in to comment.