Skip to content

Commit

Permalink
Merge pull request #4 from fac/devp/v1.2.1
Browse files Browse the repository at this point in the history
Clean up gem push output handling

See: fac/dev-platform#62
  • Loading branch information
markpitchless authored Apr 16, 2021
2 parents 727057e + 72934f9 commit 68f4b2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
## [Unreleased]
## [1.2.0] - 2021-04-15

- Fix: clean shell log handling for `gem push` call

## [1.2.0] - 2021-04-15

- Change: name to ruby-gem-push-action. Old name still works due to GH redirects.

## [1.1.0] - 2021-04-15
Expand Down
15 changes: 6 additions & 9 deletions gem-push-action
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,16 @@ elif [[ $INPUT_RELEASE != true ]]; then
exit 0
fi

# tee the output to get it in the logs but capture as we can't tell why gem
# push failed from the exit code, so need to grep the output. Gem existing is
# ok, other errors not. Avoids playing games setting up auth differently for
# gem query.
# Capture as we can't tell why gem push failed from the exit code and it logs
# everything to stdout, so need to grep the output. Gem existing is ok, other
# errors not. Avoids playing games setting up auth differently for gem query.
# Note: the glob is intentially unquoted, we want a glob!
if ! gem push --host "$GEM_HOST" $INPUT_PACKAGE_GLOB | tee push.out; then
if ! gem push --host "$GEM_HOST" $INPUT_PACKAGE_GLOB >push.out; then
gemerr=$?
sed 's/^Error:/::error::/' push.out
if grep -q "has already been pushed" push.out; then
echo Gem Already Pushed
exit 0
exit 0
fi
echo ::error::Gem Push Failed
sed 's/^/::error::/' push.out
exit $gemerr
fi

Expand Down

0 comments on commit 68f4b2e

Please sign in to comment.