From 6a942b3340894a5a2a1ef71974b46f6238e15d21 Mon Sep 17 00:00:00 2001 From: Konstantinos Athanasiou Date: Wed, 25 Dec 2024 19:46:43 +0200 Subject: [PATCH 1/7] feat: add git-cliff support --- CHANGELOG.md | 5 ++++ cliff.toml | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 CHANGELOG.md create mode 100644 cliff.toml diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2ce54b1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +All notable changes to this project will be documented in this file. + + diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 0000000..3d56204 --- /dev/null +++ b/cliff.toml @@ -0,0 +1,83 @@ +# git-cliff ~ default configuration file +# https://git-cliff.org/docs/configuration +# +# Lines starting with "#" are comments. +# Configuration options are organized into tables and keys. +# See documentation for more information on available options. + +[changelog] +# template for the changelog header +header = """ +# Changelog\n +All notable changes to this project will be documented in this file.\n +""" +# template for the changelog body +# https://keats.github.io/tera/docs/#introduction +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 | striptags | trim | upper_first }} + {% for commit in commits %} + - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\ + {% if commit.breaking %}[**breaking**] {% endif %}\ + {{ commit.message | upper_first }}\ + {% endfor %} +{% endfor %}\n +""" +# template for the changelog footer +footer = """ + +""" +# remove the leading and trailing s +trim = true +# postprocessors +postprocessors = [ + # { pattern = '', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL +] +# render body even when there are no releases to process +# render_always = true +# output file path +# output = "test.md" + +[git] +# parse the commits based on https://www.conventionalcommits.org +conventional_commits = true +# filter out the commits that are not conventional +filter_unconventional = true +# process each line of a commit as an individual commit +split_commits = false +# regex for preprocessing the commit messages +commit_preprocessors = [ + # Replace issue numbers + #{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](/issues/${2}))"}, + # Check spelling of the commit with https://github.com/crate-ci/typos + # If the spelling is incorrect, it will be automatically fixed. + #{ pattern = '.*', replace_command = 'typos --write-changes -' }, +] +# regex for parsing and grouping commits +commit_parsers = [ + { message = "^feat", group = "๐Ÿš€ Features" }, + { message = "^fix", group = "๐Ÿ› Bug Fixes" }, + { message = "^doc", group = "๐Ÿ“š Documentation" }, + { message = "^perf", group = "โšก Performance" }, + { message = "^refactor", group = "๐Ÿšœ Refactor" }, + { message = "^style", group = "๐ŸŽจ Styling" }, + { message = "^test", group = "๐Ÿงช Testing" }, + { message = "^chore\\(release\\): prepare for", skip = true }, + { message = "^chore\\(deps.*\\)", skip = true }, + { message = "^chore\\(pr\\)", skip = true }, + { message = "^chore\\(pull\\)", skip = true }, + { message = "^chore|^ci", group = "โš™๏ธ Miscellaneous Tasks" }, + { body = ".*security", group = "๐Ÿ›ก๏ธ Security" }, + { message = "^revert", group = "โ—€๏ธ Revert" }, +] +# filter out the commits that are not matched by commit parsers +filter_commits = false +# sort the tags topologically +topo_order = false +# sort the commits inside sections by oldest/newest order +sort_commits = "oldest" From 3cddc81fb036effd500306c2fdff10dfb499f3c6 Mon Sep 17 00:00:00 2001 From: Konstantinos Athanasiou Date: Wed, 25 Dec 2024 20:50:57 +0200 Subject: [PATCH 2/7] feat: add release-plz --- .github/workflows/release.yml | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8ad5af8..b626fde 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,28 +2,17 @@ name: Release Rust Crate on: workflow_dispatch: - -env: - RUST_TOOLCHAIN: stable - TOOLCHAIN_PROFILE: minimal + push: + branches: + - main + pull_request: + branches: + - main jobs: - build: - name: Build the crate - runs-on: ubuntu-latest - uses: build.yml - - publish: - name: Publish to crates.io + release-plz: + name: Release-plz runs-on: ubuntu-latest - needs: build - if: github.ref == 'refs/heads/main' - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.RUST_TOOLCHAIN }} - - name: Publish to crates.io - run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} \ No newline at end of file + - name: Run release-plz + uses: release-plz/action@v0.5 \ No newline at end of file From fff13dc5b2d389ec41df31c7f82abb6e73a610f3 Mon Sep 17 00:00:00 2001 From: Konstantinos Athanasiou Date: Wed, 25 Dec 2024 20:54:44 +0200 Subject: [PATCH 3/7] add github_token --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b626fde..235a654 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,4 +15,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Run release-plz - uses: release-plz/action@v0.5 \ No newline at end of file + uses: release-plz/action@v0.5 + env: + GITHUB_TOKEN: ${{ github.actor }} \ No newline at end of file From b5f2f9b9a7ada7d1f054b81195163ce916ab9cbb Mon Sep 17 00:00:00 2001 From: Konstantinos Athanasiou Date: Wed, 25 Dec 2024 21:00:07 +0200 Subject: [PATCH 4/7] add github_token --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 235a654..653ec07 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,4 +17,4 @@ jobs: - name: Run release-plz uses: release-plz/action@v0.5 env: - GITHUB_TOKEN: ${{ github.actor }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }} \ No newline at end of file From c9318740058852cf75246f1e944108ad21921849 Mon Sep 17 00:00:00 2001 From: Konstantinos Athanasiou Date: Wed, 25 Dec 2024 21:04:18 +0200 Subject: [PATCH 5/7] fix release --- .github/workflows/build.yml | 6 ++++++ .github/workflows/release.yml | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7e5cef4..f2807de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,13 @@ name: Build on: workflow_call: pull_request: + paths: + - 'src/**' + - 'Cargo.toml' push: + paths: + - 'src/**' + - 'Cargo.toml' env: RUST_TOOLCHAIN: stable diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 653ec07..da51503 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,11 +10,13 @@ on: - main jobs: - release-plz: + release-cli: name: Release-plz runs-on: ubuntu-latest steps: - name: Run release-plz uses: release-plz/action@v0.5 + with: + manifest_path: protypo/Cargo.toml env: GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }} \ No newline at end of file From 93d6000232359ecb552dc5fe96e487090b4b999a Mon Sep 17 00:00:00 2001 From: Konstantinos Athanasiou Date: Wed, 25 Dec 2024 21:06:57 +0200 Subject: [PATCH 6/7] fix release --- .github/workflows/release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index da51503..33c4942 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,11 @@ jobs: name: Release-plz runs-on: ubuntu-latest steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Run release-plz uses: release-plz/action@v0.5 with: From b73346b0740e27e378e38a2a47eb95d47fec02c3 Mon Sep 17 00:00:00 2001 From: Konstantinos Athanasiou Date: Wed, 25 Dec 2024 21:28:27 +0200 Subject: [PATCH 7/7] fix release --- .github/workflows/release.yml | 23 +++++++++++++---------- Cargo.toml | 2 +- protypo-cli/Cargo.toml | 2 ++ protypo/Cargo.toml | 2 ++ protypo/LICENSE | 1 - 5 files changed, 18 insertions(+), 12 deletions(-) delete mode 100644 protypo/LICENSE diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 33c4942..e288f79 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,27 +1,30 @@ -name: Release Rust Crate +name: Release-plz + +permissions: + pull-requests: write + contents: write on: - workflow_dispatch: push: branches: - main - pull_request: - branches: - - main jobs: - release-cli: - name: Release-plz + release-plz-release: + name: Release-plz release runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - + token: ${{ secrets.RELEASE_PLZ_TOKEN }} + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable - name: Run release-plz uses: release-plz/action@v0.5 with: - manifest_path: protypo/Cargo.toml + command: release env: - GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index f1a211a..6d5a9ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["protypo-*"] +members = ["protypo","protypo-cli"] exclude = ["examples/README.md","output"] resolver = "2" diff --git a/protypo-cli/Cargo.toml b/protypo-cli/Cargo.toml index 0bad323..f67c9ea 100644 --- a/protypo-cli/Cargo.toml +++ b/protypo-cli/Cargo.toml @@ -2,6 +2,8 @@ name = "protypo-cli" version = "0.1.0" edition = "2021" +license = "MIT" +description = "A code generator based on rrgen using jinja like templates." [dependencies] anyhow = "1.0" diff --git a/protypo/Cargo.toml b/protypo/Cargo.toml index 437a735..1169329 100644 --- a/protypo/Cargo.toml +++ b/protypo/Cargo.toml @@ -2,6 +2,8 @@ name = "protypo" version = "0.1.0" edition = "2021" +license = "MIT" +description = "A library for code generation using rrgen and jinja like templates." [profile.release] opt-level = 3 diff --git a/protypo/LICENSE b/protypo/LICENSE deleted file mode 100644 index ea5b606..0000000 --- a/protypo/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../LICENSE \ No newline at end of file