Skip to content

Commit

Permalink
chore: setup git cliff
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Jun 21, 2024
1 parent c25d43b commit 595c9be
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
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}"

0 comments on commit 595c9be

Please sign in to comment.