Skip to content

Commit 66a9b45

Browse files
committed
Attmpt better changelog automation
1 parent db058e1 commit 66a9b45

File tree

3 files changed

+30
-12
lines changed

3 files changed

+30
-12
lines changed

.github/workflows/tag_and_release.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,45 @@ jobs:
2323
ruby-version: 3.1
2424
bundler-cache: true
2525

26+
- name: Configure git
27+
run: |
28+
git config --local user.email "actions@github.com"
29+
git config --local user.name "Actions Auto Build"
30+
2631
- name: Get current version
2732
id: version-label
2833
run: |
2934
VERSION=$(grep VERSION lib/tailwind_merge/version.rb | head -n 1 | cut -d'"' -f2)
3035
echo "version=${VERSION}" >> $GITHUB_OUTPUT
3136
32-
# https://github.com/avakar/tag-and-release/pull/7
33-
- uses: filfreire/tag-and-release@abaaad001eaf803fddce149bb0cc09aef080773f
34-
with:
35-
tag_name: ${{ steps.version-label.outputs.version }}
36-
env:
37-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
- name: Create tag
38+
run: |
39+
git tag -a v${{ steps.version-label.outputs.version }} -m "Release v${{ steps.version-label.outputs.version }}"
40+
git push origin --tags
3841
39-
- name: Generate changelog
40-
run: script/generate_changelog
42+
- name: Generate CHANGELOG.md
43+
id: releasenotes
44+
run: |
45+
gh api repos/$GITHUB_REPOSITORY/releases/generate-notes \
46+
-f tag_name="v${{ steps.version-label.outputs.version }}" \
47+
-q .body > CHANGELOG.md
48+
echo -e "\n\n" >> CHANGELOG.md
49+
git log $(git describe --tags --abbrev=0)..HEAD --oneline >> CHANGELOG.md
4150
4251
- name: Commit & Push Changelog
4352
run: |
4453
git config --local user.email "actions@github.com"
4554
git config --local user.name "Actions Auto Build"
46-
git add -f static
55+
git add -f CHANGELOG.md
4756
git commit -m "docs: update changelog" || true
4857
git push
4958
59+
- name: Publish release
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
run: |
63+
gh release create v${{ steps.version-label.outputs.version }} --generate-notes
64+
5065
- name: Publish to RubyGems
5166
run: |
5267
mkdir -p $HOME/.gem

Rakefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

33
require "bundler/gem_tasks"
4+
require "rubygems/package_task"
45
require "rake/testtask"
56

67
Rake::TestTask.new(:test) do |t|
@@ -12,3 +13,8 @@ end
1213
require "rubocop/rake_task"
1314

1415
RuboCop::RakeTask.new
16+
17+
GEMSPEC = Bundler.load_gemspec("tailwind_merge.gemspec")
18+
gem_path = Gem::PackageTask.new(GEMSPEC).define
19+
desc "Package the ruby gem"
20+
task "package" => [gem_path]

script/generate_changelog

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)