diff --git a/.github/workflows/release-crates.yml b/.github/workflows/release-crates.yml new file mode 100644 index 000000000..c3e3e645f --- /dev/null +++ b/.github/workflows/release-crates.yml @@ -0,0 +1,53 @@ +name: Release crates + +permissions: + pull-requests: write + contents: write + +on: + push: + branches: + - master + +jobs: + # Create a PR with the new versions and changelog, preparing the next release. + open-pr: + name: Release-plz PR + runs-on: ubuntu-latest + + concurrency: + group: release-plz-${{ github.ref }} + cancel-in-progress: false + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 512 + + - name: Run release-plz + uses: release-plz/action@v0.5 + with: + command: release-pr + env: + GITHUB_TOKEN: ${{ github.token }} + + # Release unpublished packages. + release-plz-release: + name: Release-plz release + runs-on: ubuntu-latest + environment: cratesio-push + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 512 + + - name: Run release-plz + uses: release-plz/action@v0.5 + with: + command: release + env: + GITHUB_TOKEN: ${{ github.token }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_DEVOLUTIONSBOT_API_KEY }} diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 000000000..9a4f3e124 --- /dev/null +++ b/cliff.toml @@ -0,0 +1,101 @@ +# Configuration file for git-cliff + +[changelog] +trim = false + +header = """ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +""" + +# https://tera.netlify.app/docs/#introduction +body = """ +{% if version -%} + ## [[{{ version | trim_start_matches(pat="v") }}]{%- if release_link -%}({{ release_link }}){% endif %}] - {{ 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.scope %} + {%- set scope = "_" ~ commit.scope ~ "_: " %} + {%- set message = commit.message %} +{%- else %} + {%- set scope = "" %} + {%- set message = commit.message | upper_first %} +{%- endif %} + +{%- if commit.breaking %} + {%- set breaking = "[**breaking**] " %} +{%- else %} + {%- set breaking = "" %} +{%- endif %} + +{%- set short_sha = commit.id | truncate(length=10, end="") %} +{%- set commit_url = "https://github.com/Devolutions/IronRDP/commit/" ~ commit.id %} +{%- set commit_link = "[" ~ short_sha ~ "](" ~ commit_url ~ ")" %} + +- {{ scope }}{{ breaking }}{{ message }} ({{commit_link}}) \ + {% if commit.body %}\n\n {{ commit.body | replace(from="\n", to="\n ") }}{% endif %} +{%- endfor %} + +{% endfor -%} +""" + +footer = "" + +[git] +conventional_commits = true +filter_unconventional = false +filter_commits = false +date_order = false +sort_commits = "oldest" + +commit_preprocessors = [ + # Replace issue number with the link + { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/Devolutions/IronRDP/issues/${2}))"}, + # Replace commit sha1 with the link + { pattern = '([a-f0-9]{10})([a-f0-9]{30})', replace = "[${0}](https://github.com/Devolutions/IronRDP/commit/${1}${2})" } +] + +# regex for parsing and grouping commits +# is a trick to control the section order: https://github.com/orhun/git-cliff/issues/9#issuecomment-914521594 +commit_parsers = [ + { message = "^chore", skip = true }, + { message = "^style", skip = true }, + { message = "^refactor", skip = true }, + { message = "^test", skip = true }, + { message = "^ci", skip = true }, + { message = "^chore\\(release\\): prepare for", skip = true }, + { message = "^chore\\(deps\\)", skip = true }, + { message = "^build\\(deps\\)", skip = true }, + { footer = "^[Cc]hangelog: ?ignore", skip = true }, + + { message = "(?i)security", group = "Security" }, + { body = "(?i)security", group = "Security" }, + { footer = "^[Ss]ecurity: ?yes", group = "Security" }, + + { message = "^feat", group = "Features" }, + + { message = "^revert", group = "Revert" }, + { message = "^fix", group = "Bug Fixes" }, + { message = "^perf", group = "Performance" }, + { message = "^doc", group = "Documentation" }, + { message = "^build", group = "Build" }, + + { message = "(?i)improve", group = "Improvements" }, + { message = "(?i)adjust", group = "Improvements" }, + { message = "(?i)change", group = "Improvements" }, + + { message = ".*", group = "Please Sort" }, +]