ruby-macho icon indicating copy to clipboard operation
ruby-macho copied to clipboard

Add a RubyGems publishing workflow

Open woodruffw opened this issue 3 years ago • 4 comments

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 avatar Oct 12 '20 21:10 woodruffw

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

BrewTestBot avatar Dec 15 '20 21:12 BrewTestBot

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.

apainintheneck avatar Mar 16 '22 19:03 apainintheneck

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

woodruffw avatar Jul 25 '23 15:07 woodruffw

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.)

woodruffw avatar Sep 14 '23 03:09 woodruffw