Skip to content

Commit

Permalink
GitHub release (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimtng authored Dec 19, 2023
1 parent 3b42eb8 commit b2a9b34
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 119 deletions.
11 changes: 11 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
changelog:
categories:
- title: Breaking Changes
labels:
- breaking
- title: Features
labels:
- enhancement
- title: Bug Fixes
labels:
- bug
53 changes: 29 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,36 @@ jobs:
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 }}
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]
echo "Generating release notes"
gh release create v${{ env.NEW_VERSION }} --generate-notes --draft
echo "Saving release notes"
gh release view v${{ env.NEW_VERSION }} --json body | jq -r .body | sed '1,3d' > new_changes.md
echo "Deleting draft release"
gh release delete v${{ env.NEW_VERSION }} --cleanup-tag --yes`
echo "Updating CHANGELOG"
bin/rake changelog[${{ env.OLD_VERSION }},${{ env.NEW_VERSION }},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
gh release create v${{ env.NEW_VERSION }} --notes-file 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
67 changes: 0 additions & 67 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,12 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activesupport (6.1.7.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
async (1.31.0)
console (~> 1.10)
nio4r (~> 2.3)
timers (~> 4.1)
async-http (0.59.5)
async (>= 1.25)
async-io (>= 1.28)
async-pool (>= 0.2)
protocol-http (~> 0.23)
protocol-http1 (~> 0.14.0)
protocol-http2 (~> 0.14.0)
traces (>= 0.8.0)
async-http-faraday (0.12.0)
async-http (~> 0.42)
faraday
async-io (1.35.0)
async
async-pool (0.4.0)
async (>= 1.25)
builder (3.2.4)
byebug (11.1.3)
coderay (1.1.3)
commonmarker (0.23.10)
concurrent-ruby (1.2.2)
console (1.15.3)
fiber-local
cucumber (8.0.0)
builder (~> 3.2, >= 3.2.4)
cucumber-ci-environment (~> 9.0, >= 9.0.4)
Expand Down Expand Up @@ -88,27 +59,15 @@ GEM
faraday (2.7.10)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-http-cache (2.5.0)
faraday (>= 0.8)
faraday-net_http (3.0.2)
faraday-retry (2.2.0)
faraday (~> 2.0)
ffi (1.15.5)
ffi (1.15.5-java)
fiber-local (1.0.0)
formatador (1.1.0)
gem-release (2.2.2)
gene_pool (1.5.0)
concurrent-ruby (>= 1.0)
github_changelog_generator (1.16.4)
activesupport
async (>= 1.25.0)
async-http-faraday
faraday-http-cache
multi_json
octokit (~> 4.6)
rainbow (>= 2.2.1)
rake (>= 10.0)
guard (2.18.0)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
Expand All @@ -131,8 +90,6 @@ GEM
httparty (0.21.0)
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
io-console (0.6.0)
io-console (0.6.0-java)
irb (1.6.3)
Expand All @@ -149,13 +106,9 @@ GEM
mime-types-data (~> 3.2015)
mime-types-data (3.2023.0808)
mini_mime (1.1.5)
minitest (5.20.0)
multi_json (1.15.0)
multi_test (1.1.0)
multi_xml (0.6.0)
nenv (0.3.0)
nio4r (2.5.9)
nio4r (2.5.9-java)
nokogiri (1.13.10-arm64-darwin)
racc (~> 1.4)
nokogiri (1.13.10-java)
Expand All @@ -167,9 +120,6 @@ GEM
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
octokit (4.25.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
parallel (1.23.0)
parser (3.2.2.3)
ast (~> 2.4.1)
Expand All @@ -182,21 +132,13 @@ GEM
httparty (~> 0.9)
persistent_http (< 2)
process_exists (0.2.0)
protocol-hpack (1.4.2)
protocol-http (0.24.4)
protocol-http1 (0.14.6)
protocol-http (~> 0.22)
protocol-http2 (0.14.2)
protocol-hpack (~> 1.4)
protocol-http (~> 0.18)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry (0.14.2-java)
coderay (~> 1.1)
method_source (~> 1.0)
spoon (~> 0.0)
public_suffix (5.0.3)
racc (1.7.1)
racc (1.7.1-java)
rack (2.2.8)
Expand Down Expand Up @@ -249,9 +191,6 @@ GEM
rubocop-capybara (~> 2.17)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
shellany (0.0.1)
spoon (0.0.6)
ffi
Expand All @@ -263,17 +202,12 @@ GEM
rack (>= 1, < 3)
thor (1.2.2)
timecop (0.9.8)
timers (4.3.5)
traces (0.11.1)
tty-color (0.6.0)
tty-command (0.10.1)
pastel (~> 0.8)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)
webrick (1.7.0)
yaml-lint (0.1.2)
zeitwerk (2.6.11)

PLATFORMS
arm64-darwin-21
Expand All @@ -290,7 +224,6 @@ DEPENDENCIES
cuke_linter (~> 1.2)
faraday-retry (~> 2.1)
gem-release (~> 2.2)
github_changelog_generator (~> 1.16)
guard-rubocop (~> 1.5)
guard-shell (~> 0.7)
guard-yard (~> 2.2)
Expand Down
1 change: 0 additions & 1 deletion openhab-scripting.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "cuke_linter", "~> 1.2"
spec.add_development_dependency "faraday-retry", "~> 2.1"
spec.add_development_dependency "gem-release", "~> 2.2"
spec.add_development_dependency "github_changelog_generator", "~> 1.16"
spec.add_development_dependency "guard-rubocop", "~> 1.5"
spec.add_development_dependency "guard-shell", "~> 0.7"
spec.add_development_dependency "guard-yard", "~> 2.2"
Expand Down
31 changes: 4 additions & 27 deletions rakelib/changelog.rake
Original file line number Diff line number Diff line change
@@ -1,40 +1,17 @@
# frozen_string_literal: true

require "github_changelog_generator/task"

module GitHubChangelogGenerator
class Generator
# Don't add any header or footer
def insert_fixed_string(log)
log
end
end
end

directory "tmp"

desc "Generate Changelog"
task :changelog, %i[old_version new_version output] => ["tmp"] do |_task, args|
old_version, new_version, new_filename = args.values_at(:old_version, :new_version, :output)
unless old_version && new_version && new_filename
raise ArgumentError, "old_version, new_version, and output arguments must be specified"
end

GitHubChangelogGenerator::RakeTask.new :new_changelog do |config|
config.user = "openhab"
config.project = "openhab-jruby"
config.since_tag = "v#{old_version}"
config.future_release = "v#{new_version}"
config.bug_prefix = "### Bug Fixes"
config.enhancement_prefix = "### Features"
config.issues = true
config.add_pr_wo_labels = false
config.add_issues_wo_labels = false
config.exclude_labels = ["documentation"]
config.output = new_filename
end
today = Time.now.strftime("%Y-%m-%d")
header = "## [v#{new_version}](https://github.com/openhab/openhab-jruby/tree/v#{new_version}) (#{today})\n\n"

Rake::Task["new_changelog"].execute
release_notes = File.read(new_filename)
File.write(new_filename, "#{header}\n\n#{release_notes}")

insert_new_changelog(new_filename, main_filename: "CHANGELOG.md")
end
Expand Down

0 comments on commit b2a9b34

Please sign in to comment.