Release Ruby Gem #29
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Ruby Gem | |
on: | |
workflow_dispatch: | |
inputs: | |
otp: | |
description: 'One-time password for RubyGems' | |
required: true | |
env: | |
ACTIONS_STEP_DEBUG: true | |
jobs: | |
build: | |
name: Build + Publish | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0 | |
with: | |
ruby-version: "3.3" | |
bundler-cache: true | |
- name: Configure Git | |
run: | | |
git config --global user.name "${GITHUB_ACTOR}" | |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
- name: Publish to GPR | |
run: | | |
mkdir -p $HOME/.gem | |
touch $HOME/.gem/credentials | |
chmod 0600 $HOME/.gem/credentials | |
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials | |
bundle exec rake build | |
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} pkg/*.gem | |
env: | |
GEM_HOST_API_KEY: "Bearer ${{ secrets.GITHUB_TOKEN }}" | |
OWNER: ${{ github.repository_owner }} | |
- name: Publish to RubyGems | |
run: bundle exec rake release | |
env: | |
GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_AUTH_TOKEN }}" | |
GEM_HOST_OTP_CODE: "${{ github.event.inputs.otp }}" | |
- name: Latest tag | |
run: | | |
echo "name=$(git describe --tags --abbrev=0)" >> "$GITHUB_OUTPUT" | |
id: tag | |
- name: Create GitHub release | |
run: gh release create "${TAG_NAME}" --title "${TAG_NAME}" --generate-notes --draft | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAG_NAME: ${{ steps.tag.outputs.name }} |