Release #12
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
prerelease: | |
description: "Prerelease" | |
required: true | |
default: false | |
type: boolean | |
draft: | |
description: "Draft" | |
required: true | |
default: false | |
type: boolean | |
version-increment-type: | |
description: 'Which part of the version to increment:' | |
required: true | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
default: 'patch' | |
permissions: | |
contents: write | |
jobs: | |
release: | |
name: Version Bump and Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
fetch-depth: 0 | |
- uses: DevCycleHQ/release-action/prepare-release@v2.3.0 | |
id: prepare-release | |
with: | |
github-token: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
prerelease: ${{ github.event.inputs.prerelease }} | |
draft: ${{ github.event.inputs.draft }} | |
version-increment-type: ${{ github.event.inputs.version-increment-type }} | |
- name: Update Version in code | |
run: | | |
sed -i "s/VERSION = '[0-9]\+\.[0-9]\+\.[0-9]\+'/VERSION = '${{steps.prepare-release.outputs.next-release-tag}}'/g" ./lib/devcycle-ruby-server-sdk/version.rb | |
- name: Commit version change | |
run: | | |
git config --global user.email "github-tracker-bot@taplytics.com" | |
git config --global user.name "DevCycle Automation" | |
git add ./lib/devcycle-ruby-server-sdk/version.rb | |
git commit -m "Release ${{steps.prepare-release.outputs.next-release-tag}}" | |
- name: Push version change | |
run: | | |
git push origin HEAD:main | |
if: inputs.draft != true | |
- name: Set up Ruby 3 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.2.0' | |
bundler-cache: true | |
- name: Publish to RubyGems | |
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}}" | |
if: inputs.prerelease != true && inputs.draft != true | |
- uses: DevCycleHQ/release-action/create-release@v2.3.0 | |
id: create-release | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ steps.prepare-release.outputs.next-release-tag }} | |
target: main | |
prerelease: ${{ github.event.inputs.prerelease }} | |
draft: ${{ github.event.inputs.draft }} | |
changelog: ${{ steps.prepare-release.outputs.changelog }} | |
- name: Display link to release | |
run: | | |
echo "::notice title=Release ID::${{ steps.create-release.outputs.release-id }}" | |
echo "::notice title=Release URL::${{ steps.create-release.outputs.release-url }}" |