Skip to content

Commit

Permalink
fix: gem push
Browse files Browse the repository at this point in the history
  • Loading branch information
thde committed Sep 27, 2023
1 parent a373708 commit 426b2df
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 45 deletions.
45 changes: 0 additions & 45 deletions .github/workflows/publish.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,38 @@ jobs:
with:
allow-initial-development-versions: true
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: check if tag has been created
run: test -n "$(git tag --points-at HEAD)" && echo "PUBLISH=true" >> $GITHUB_ENV || echo "PUBLISH=false" >> $GITHUB_ENV
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
- run: bundle install
- run: gem build *.gemspec
if: ${{ env.PUBLISH != "true" }}
- run: gem build *.gemspec
if: ${{ env.PUBLISH == "true" }}
env:
CI_COMMIT_TAG: ${{github.ref_name}}
- name: prepare gem credential
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
- name: publish to GPR
if: ${{ env.PUBLISH == "true" }}
run: |
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
env:
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
OWNER: ${{ github.repository_owner }}
- name: publish to RubyGems
if: ${{ env.PUBLISH == "true" }}
run: |
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem push *.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"

0 comments on commit 426b2df

Please sign in to comment.