Skip to content

Commit f0ed469

Browse files
committed
Refactor gem publishing workflow to publish to RubyGems instead of GitHub Packages, updating permissions and conditions for execution.
1 parent a4d2881 commit f0ed469

1 file changed

Lines changed: 24 additions & 30 deletions

File tree

.github/workflows/native-gems.yml

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -46,35 +46,29 @@ jobs:
4646
name: parsekit-${{ matrix.platform }}
4747
path: pkg/*${{ matrix.platform }}.gem
4848
if-no-files-found: error
49-
publish:
50-
name: Publish gems to GitHub Packages
51-
needs: build
52-
runs-on: ubuntu-latest
53-
permissions:
54-
contents: read
55-
packages: write
56-
steps:
57-
- name: Download all gem artifacts
58-
uses: actions/download-artifact@v4
59-
with:
60-
pattern: parsekit-*
61-
merge-multiple: true
62-
path: pkg
6349

64-
- name: Configure RubyGems credentials for GitHub Packages
65-
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67-
run: |
68-
mkdir -p ~/.gem
69-
printf -- "---\n:github: Bearer %s\n" "$GITHUB_TOKEN" > ~/.gem/credentials
70-
chmod 0600 ~/.gem/credentials
50+
publish:
51+
name: Publish gems to RubyGems
52+
needs: build
53+
runs-on: ubuntu-latest
54+
if: startsWith(github.ref, 'refs/tags/')
55+
permissions:
56+
contents: read
57+
steps:
58+
- name: Download all gem artifacts
59+
uses: actions/download-artifact@v4
60+
with:
61+
pattern: parsekit-*
62+
merge-multiple: true
63+
path: pkg
7164

72-
- name: Push gems to GitHub Packages
73-
env:
74-
OWNER: ${{ github.repository_owner }}
75-
run: |
76-
shopt -s nullglob
77-
for g in pkg/*.gem; do
78-
echo "Pushing $g"
79-
gem push --key github --host "https://rubygems.pkg.github.com/Teamtailor" "$g"
80-
done
65+
- name: Publish to RubyGems
66+
env:
67+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
68+
run: |
69+
set -euo pipefail
70+
shopt -s nullglob
71+
for gem_file in pkg/*.gem; do
72+
echo "Pushing ${gem_file}"
73+
gem push "$gem_file"
74+
done

0 commit comments

Comments
 (0)