Skip to content

Release a New Version #31

Release a New Version

Release a New Version #31

Workflow file for this run

name: Release a New Version
on:
workflow_dispatch:
inputs:
version:
description: "New Version. major|minor|patch|rc or an explicit version number."
required: true
default: patch
type: string
options:
- major
- minor
- patch
- rc
env:
RUBY_VERSION: 3.1.3
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
release:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.bump_version.outputs.new_version }}
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: git-actions/set-user@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
- name: Bump version
id: bump_version
run: |
bundle config unset deployment
ruby -Ilib/openhab/dsl -r version -e 'puts "OLD_VERSION=#{OpenHAB::DSL::VERSION}"' >> $GITHUB_ENV
bundle exec gem bump -v ${{ inputs.version }} -m "v%{version}" --file lib/openhab/dsl/version.rb
ruby -Ilib/openhab/dsl -r version -e 'puts "NEW_VERSION=#{OpenHAB::DSL::VERSION}"' >> $GITHUB_ENV
ruby -Ilib/openhab/dsl -r version -e 'puts "new_version=#{OpenHAB::DSL::VERSION}"' >> $GITHUB_OUTPUT
- name: Generate CHANGELOG
env:
GH_TOKEN: ${{ github.token }}
run: |
bin/rake update_doc_links[${{ env.OLD_VERSION }},${{ env.NEW_VERSION }}]
bin/rake changelog[${{ env.OLD_VERSION }},${{ env.NEW_VERSION }},tmp/new_changes.md]
git add Gemfile.lock CHANGELOG.md USAGE.md templates .known_good_references
git commit --amend --no-edit
gh release create v${{ env.NEW_VERSION }} --notes-file tmp/new_changes.md
# - name: Release Gem
# env:
# GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
# run: |
# bin/rake release || (git status; false)
# publish_main_docs:
# needs: release
# uses: ./.github/workflows/yardoc.yml
# with:
# ref_name: main
# ref_type: branch
# publish_tag_docs:
# needs: release
# uses: ./.github/workflows/yardoc.yml
# with:
# ref_name: v${{needs.release.outputs.NEW_VERSION}}
# ref_type: tag