From 59023606b889379bc856b5145f699d150bc76057 Mon Sep 17 00:00:00 2001 From: Alon Gubkin Date: Tue, 7 Apr 2026 18:54:20 +0300 Subject: [PATCH] ci: automate releases with release-plz Replace the manual release workflow with release-plz, which automatically opens release PRs with version bumps and changelog updates, then tags, creates GitHub Releases, and publishes to crates.io on merge. Closes ALIEN-15 Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/release-plz.yml | 40 +++++++++++++++++++++++++++ .github/workflows/release.yml | 23 ---------------- cliff.toml | 46 +++++++++++++++++++++++++++++++ release-plz.toml | 5 ++++ 4 files changed, 91 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/release-plz.yml delete mode 100644 .github/workflows/release.yml create mode 100644 cliff.toml create mode 100644 release-plz.toml diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml new file mode 100644 index 0000000..de87b97 --- /dev/null +++ b/.github/workflows/release-plz.yml @@ -0,0 +1,40 @@ +name: Release-plz + +permissions: + pull-requests: write + contents: write + +on: + push: + branches: + - main + +jobs: + release-plz-release-pr: + name: Release PR + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: dtolnay/rust-toolchain@stable + - uses: MarcoIeni/release-plz-action@v0.5 + with: + command: release-pr + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }} + + release-plz-release: + name: Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: dtolnay/rust-toolchain@stable + - uses: MarcoIeni/release-plz-action@v0.5 + with: + command: release + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 6070d20..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Release - -on: - release: - types: [published] - -permissions: - contents: read - -env: - CARGO_TERM_COLOR: always - -jobs: - publish: - name: Publish to crates.io - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - - run: cargo publish - env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 0000000..efbfd6e --- /dev/null +++ b/cliff.toml @@ -0,0 +1,46 @@ +[changelog] +header = """ +# Changelog + +All notable changes to this project will be documented in this file. + +""" +body = """ +{%- macro remote_url() -%} + https://github.com/alienplatform/dockdash +{%- endmacro -%} + +{% 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 }} \ + ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\ + {% endfor %} +{% endfor %} +""" +trim = true + +[git] +conventional_commits = true +filter_unconventional = true +split_commits = false +commit_parsers = [ + { message = "^feat", group = "Features" }, + { message = "^fix", group = "Bug Fixes" }, + { message = "^doc", group = "Documentation" }, + { message = "^perf", group = "Performance" }, + { message = "^refactor", group = "Refactoring" }, + { message = "^style", group = "Styling" }, + { message = "^test", group = "Testing" }, + { message = "^chore\\(release\\)", skip = true }, + { message = "^chore", group = "Miscellaneous" }, +] +filter_commits = false +tag_pattern = "v[0-9].*" diff --git a/release-plz.toml b/release-plz.toml new file mode 100644 index 0000000..7408c68 --- /dev/null +++ b/release-plz.toml @@ -0,0 +1,5 @@ +[workspace] +changelog_config = "cliff.toml" +changelog_update = true +git_tag_name = "v{{ version }}" +pr_name = "chore: release v{{ version }}"