Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a RubyGems publishing workflow #273

Open
woodruffw opened this issue Oct 12, 2020 · 4 comments
Open

Add a RubyGems publishing workflow #273

woodruffw opened this issue Oct 12, 2020 · 4 comments

Comments

@woodruffw
Copy link
Member

I currently release new versions of the ruby-macho gem from my desktop. This isn't ideal, both security wise and in terms of availability for other Homebrew maintainers. So, we should use GitHub Actions to automatically publish releases instead.

Some notes:

  • It looks like gem push can use GEM_HOST_API_KEY in the environment to get a RubyGems API key
@woodruffw woodruffw self-assigned this Oct 12, 2020
@BrewTestBot
Copy link
Member

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@apainintheneck
Copy link
Contributor

https://andrewm.codes/blog/automating-ruby-gem-releases-with-github-actions/
This article might be useful for you if you want to combine the release updating and gem publishing steps into one workflow.

@woodruffw
Copy link
Member Author

Removed the old GitHub-only release workflow, since it wasn't doing anything useful. I'll look into a RubyGems publishing flow tonight.

@woodruffw
Copy link
Member Author

For reference: I just refactored another one of my gems' CI's, and this sufficed:

on:
  push:
    tags:
      - 'v*'

name: release

jobs:
  create-release:
    name: create GitHub release
    runs-on: ubuntu-latest
    permissions:
      contents: write

    steps:
      - name: Release
        uses: softprops/action-gh-release@v1
        with:
          prerelease: ${{ contains(github.ref, 'pre') || contains(github.ref, 'rc') }}

  rubygems:
    name: publish to RubyGems
    runs-on: ubuntu-latest
    needs:
      - create-release

    steps:
      - uses: actions/checkout@v4

      - name: push to RubyGems
        run: |
          gem build lzfse.gemspec
          gem push lzfse-*.gem
        env:
          GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}

(Would need some small tweaks for ruby-macho, but the basic idea is the same.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants