Skip to content

Release a New Version #61

Release a New Version

Release a New Version #61

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
permissions:
contents: write
id-token: write
outputs:
new_version: ${{ steps.bump_version.outputs.new_version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: git-actions/set-user@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
rubygems: latest
- 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
bundle install
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 }}]
gh release create v${{ env.NEW_VERSION }} --generate-notes --draft
gh release view v${{ env.NEW_VERSION }} --json body | jq -r .body | sed '1,3d' > new_changes.md
gh release delete v${{ env.NEW_VERSION }} --yes
bin/rake changelog[${{ env.OLD_VERSION }},${{ env.NEW_VERSION }},new_changes.md]
# @deprecated OH3.4 Gemfile.ruby-2.6 is only for OH3
git add Gemfile.lock Gemfile.ruby-2.6.lock CHANGELOG.md USAGE.md templates .known_good_references
git commit --amend --no-edit
- uses: rubygems/release-gem@v1
with:
await-release: false
- name: Create Github Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create v${{ env.NEW_VERSION }} --notes-file 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