|
36 | 36 | echo "version=$VERSION" >> $GITHUB_OUTPUT |
37 | 37 | echo "Extracted version: $VERSION" |
38 | 38 |
|
| 39 | + - name: Check current version |
| 40 | + id: current_version |
| 41 | + run: | |
| 42 | + CURRENT_VERSION=$(ruby -e "require_relative 'lib/session_recorder/version'; puts Multiplayer::SessionRecorder::VERSION") |
| 43 | + echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT |
| 44 | + echo "Current version in file: $CURRENT_VERSION" |
| 45 | + echo "Tag version: ${{ steps.version.outputs.version }}" |
| 46 | +
|
39 | 47 | - name: Update version file |
40 | 48 | run: | |
41 | 49 | # Update the version in lib/session_recorder/version.rb |
|
54 | 62 | run: | |
55 | 63 | git config --local user.email "[email protected]" |
56 | 64 | git config --local user.name "GitHub Action" |
57 | | - git add lib/session_recorder/version.rb |
58 | | - git commit -m "chore: bump version to ${{ steps.version.outputs.version }}" |
59 | | - git push origin main |
| 65 | + |
| 66 | + # Check if there are changes to commit |
| 67 | + if git diff --quiet; then |
| 68 | + echo "No changes to commit - version already up to date" |
| 69 | + else |
| 70 | + git add lib/session_recorder/version.rb |
| 71 | + git commit -m "chore: bump version to ${{ steps.version.outputs.version }}" |
| 72 | + git push origin main |
| 73 | + echo "Version updated and pushed successfully" |
| 74 | + fi |
60 | 75 |
|
61 | 76 | - name: Configure Bundler |
62 | 77 | run: | |
@@ -101,11 +116,27 @@ jobs: |
101 | 116 | fi |
102 | 117 | fi |
103 | 118 |
|
| 119 | + - name: Configure RubyGems credentials |
| 120 | + run: | |
| 121 | + # Create .gemrc file with API key |
| 122 | + cat > ~/.gemrc << EOF |
| 123 | + --- |
| 124 | + :rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }} |
| 125 | + EOF |
| 126 | + echo "RubyGems credentials configured" |
| 127 | +
|
104 | 128 | - name: Publish to RubyGems |
105 | 129 | env: |
106 | 130 | RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} |
107 | 131 | run: | |
108 | | - gem push "${{ steps.gem_file.outputs.gem_path }}" |
| 132 | + # Verify API key is set |
| 133 | + if [ -z "$RUBYGEMS_API_KEY" ]; then |
| 134 | + echo "Error: RUBYGEMS_API_KEY is not set" |
| 135 | + exit 1 |
| 136 | + fi |
| 137 | + |
| 138 | + echo "Publishing gem: ${{ steps.gem_file.outputs.gem_path }}" |
| 139 | + gem push "${{ steps.gem_file.outputs.gem_path }}" --key "$RUBYGEMS_API_KEY" |
109 | 140 |
|
110 | 141 | - name: Create GitHub Release |
111 | 142 | uses: actions/create-release@v1 |
|
0 commit comments