diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml new file mode 100644 index 00000000..dcdc1d82 --- /dev/null +++ b/.github/workflows/release-plz.yml @@ -0,0 +1,52 @@ +name: Release-plz + +permissions: + pull-requests: write + contents: write + +on: + push: + branches: + - main + +jobs: + # Release unpublished packages. + release-plz-release: + name: Release-plz release + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + - name: Run release-plz + uses: release-plz/action@v0.5 + with: + command: release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }} + + # Create a PR with the new versions and changelog, preparing the next release. + release-plz-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: 0 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + - name: Run release-plz + uses: release-plz/action@v0.5 + with: + command: release-pr + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }} diff --git a/cliff.toml b/cliff.toml index c62e8a76..8814c9a8 100644 --- a/cliff.toml +++ b/cliff.toml @@ -24,7 +24,7 @@ body = """ {%- if not version %} ## [unreleased] {% else -%} -## [{{ version }}](https://github.com/ratatui/ratatui/releases/tag/{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }} +## {{ package }} - [{{ version }}]({{ release_link }}) - {{ timestamp | date(format="%Y-%m-%d") }} {% endif -%} {% macro commit(commit) -%} @@ -47,26 +47,16 @@ body = """ {%- endfor -%} {%- endfor %} -{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %} -### New Contributors -{%- endif %}\ -{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %} -* @{{ contributor.username }} made their first contribution -{%- if contributor.pr_number %} in \ -[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \ -{%- endif %} -{%- endfor -%} - {% if version %} {% if previous.version %} -**Full Changelog**: {{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }} +**Full Changelog**: {{ release_link }} {% endif %} {% else -%} {% raw %}\n{% endraw %} {% endif %} {%- macro remote_url() -%} -https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\ +https://github.com/{{ remote.owner }}/{{ remote.repo }}\ {% endmacro %} """ diff --git a/release-plz.toml b/release-plz.toml new file mode 100644 index 00000000..775d3c25 --- /dev/null +++ b/release-plz.toml @@ -0,0 +1,5 @@ +[workspace] +changelog_path = "./CHANGELOG.md" +changelog_config = "cliff.toml" +release_always = false +semver_check = false