Skip to content

Publish Release

Publish Release #41

Workflow file for this run

name: Publish Release
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
jobs:
publish_release:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true
- id: published_version
run: echo ::set-output name=published_version::$(gem list yalphabetize --remote | tail -n 1 | cut -d "(" -f2 | cut -d ")" -f1)
- id: bundled_version
run: echo ::set-output name=bundled_version::$(bundle info yalphabetize | head -n 1 | cut -d "(" -f2 | cut -d ")" -f1)
- name: Publish release
if: ${{ steps.published_version.outputs.published_version < steps.bundled_version.outputs.bundled_version }}
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.bundled_version.outputs.bundled_version }}
- name: Publish to RubyGems
if: ${{ steps.published_version.outputs.published_version < steps.bundled_version.outputs.bundled_version }}
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push *.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"