Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: setup git cliff #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish

on:
workflow_dispatch:
# inputs:
# nightly:
# type: boolean
# default: true
# required: false
# description: 'Publish a nightly build'
jobs:
publish-github-release:
name: Publish to GitHub Releases
needs: [ build ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate release notes
id: release-notes
uses: orhun/git-cliff-action@v2
with:
config: cliff.toml
args: -vv --latest --strip header
env:
OUTPUT: CHANGES.md

- name: Strip tag from release notes
run: tail -n +3 < CHANGES.md > RELEASE_NOTES.md

- name: Rename artifact
run: mv "Biome-${{ needs.build.outputs.version }}.zip" biome.zip

- name: Publish extension to GitHub Releases
uses: softprops/action-gh-release@v1
with:
name: "v${{ needs.build.outputs.version }}"
body_path: RELEASE_NOTES.md
prerelease: ${{ needs.build.outputs.nightly == 'true' }}
draft: true
files: biome.zip
tag_name: ${{ needs.build.outputs.nightly == 'true' && github.ref || format('v{0}', needs.build.outputs.version) }}
48 changes: 48 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[changelog]

header = """
# Changelog\n
All notable changes to this project will be documented in this file.\n
"""

body = """
{% if version %}\
## {{ version | trim_start_matches(pat="v") }} - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
{% endfor %}
{% endfor %}\n
"""

# Trim leading and trailing whitespace from changelog
trim = true

[git]

# Parse commits based on the conventional commits specification
conventional_commits = true

# Filter out commits that do not follow the conventional commits specification
filter_unconventional = true

# Filter out the commits that are not matched by commit parsers
filter_commits = true

commit_preprocessors = [
{ pattern = "\\(#([0-9]+)\\)", replace = "([#${1}](https://github.com/biomejs/biome-vscode/pull/${1}))" },
]

# Commit parsers to use for parsing commits
commit_parsers = [
{ message = "^feat*", group = "<!-- 0 -->:rocket: New features" },
{ message = "^fix*", group = "<!-- 1 -->:bug: Bug fixes" },
{ message = "^doc", group = "<!-- 2 -->:book: Documentation" },
]

# Regex for matching git tags
tag_pattern = "v[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}"