Release a New Version #20
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 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: | |
CHANGELOG_GITHUB_TOKEN: ${{ secrets.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 | |
- name: Release Gem | |
env: | |
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }} | |
run: | | |
git commit --amend --no-edit | |
bin/rake release || (git status; false) | |
- name: Create Github Release | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh release create v${{ env.NEW_VERSION }} --notes-file tmp/new_changes.md | |
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 |