I have a Ruby gem which I’ve been building with Travis but I want to make the transition to GitHub actions. I took the example Ruby gem action and expanded upon it somewhat, but I feel it could be further improved. The file as it stands now:
As you can see I have three jobs:
- rubocop - checks for code style
- rspec - depends on rubocop and runs the test suite
- publish - depends on rspec and publishes the gem if the action was run on the master branch
What I would like to improve:
- All three jobs run the checkout and Ruby setup steps, is it possible to run these only one time? I mean once rubocop finishes it would preserve the project directory and the next step would continue from that point.
- Is it possible to somehow separate the publish job so that it doesn’t even start on branches that are different from master?