File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change 1- # .github/workflows/publish-ruby.yml
21name : Publish Ruby Gem
32
43on :
7069 run : |
7170 GEM_FILE=$(ls *.gem | head -1)
7271 echo "Publishing $GEM_FILE to RubyGems..."
73- gem push "$GEM_FILE"
72+
73+ # Get gem name and version for debugging
74+ GEM_NAME=$(gem specification "$GEM_FILE" name)
75+ GEM_VERSION=$(gem specification "$GEM_FILE" version)
76+ echo "Gem name: $GEM_NAME"
77+ echo "Gem version: $GEM_VERSION"
78+
79+ # Check if gem already exists
80+ if gem list "$GEM_NAME" --remote | grep -q "$GEM_NAME"; then
81+ echo "Gem $GEM_NAME already exists on RubyGems.org"
82+ # Check if this specific version exists
83+ if gem list "$GEM_NAME" --remote --exact | grep -q "$GEM_VERSION"; then
84+ echo "ERROR: Version $GEM_VERSION of $GEM_NAME already exists!"
85+ echo "You need to increment the version number."
86+ exit 1
87+ fi
88+ fi
89+
90+ # Try to push with verbose output
91+ gem push "$GEM_FILE" --verbose
7492 echo "✓ Successfully published to RubyGems.org"
7593
7694 - name : Clean up credentials
You can’t perform that action at this time.
0 commit comments