Publishing Package Version 0.3.10 #15
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: publish-package | |
run-name: Publishing Package Version ${{ github.event.inputs.Version }} | |
on: | |
# Manually publish | |
workflow_dispatch: | |
inputs: | |
Version: | |
description: "This input field requires version in format: x.y.z, where x => major version, y => minor version and z => patch version" | |
required: true | |
jobs: | |
publish-gem: | |
name: Publish Gem | |
environment: Production | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Ruby 3.2 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2 | |
- run: bundle install | |
- name: Publish to RubyGems | |
id: release | |
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.RUBY_GEMS_TOKEN }}" | |
- name: Create tag | |
if: steps.release.outputs.exit_code == 0 | |
id: tag_version | |
uses: mathieudutour/github-tag-action@v6.0 | |
with: | |
github_token: ${{ secrets.TAGS_TOKEN }} | |
custom_tag: ${{ github.event.inputs.Version }} | |
tag_prefix: "" | |
- name: Create changelog for the release | |
if: steps.release.outputs.exit_code == 0 | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: Release Version ${{ github.event.inputs.Version }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
- name: Send slack notification | |
id: slack | |
uses: slackapi/slack-github-action@v1.25.0 | |
with: | |
channel-id: 'C012YFE3D6D' | |
slack-message: "core-lib-ruby release has been triggered!" | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |