Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task: move to release-plz for release workflow #4

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
commit-message:
prefix: "dep-update: "
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
commit-message:
prefix: "dep-update: "
open-pull-requests-limit: 10
14 changes: 14 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pull_request_rules:
- name: Automatic merge for Dependabot pull requests
conditions:
- author=dependabot[bot]
actions:
merge:
method: squash
- name: Automatic update to the main branch for pull requests
conditions:
- -conflict
- -draft
- -author=dependabot[bot]
actions:
update:
25 changes: 7 additions & 18 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,20 @@ on:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest
env:
CI: 1
CARGO_INCREMENTAL: 0
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
- name: Checkout code
uses: actions/checkout@v4
with:
toolchain: 1.63.0-x86_64-unknown-linux-gnu
profile: minimal
override: true
- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
with: { command: generate-lockfile }
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
fetch-depth: 0
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Test
timeout-minutes: 10
run: |
cargo test
- name: Clear the cargo caches
run: |
cargo install cargo-cache --version 0.8.2 --no-default-features --features ci-autoclean
cargo-cache
run: cargo test
37 changes: 37 additions & 0 deletions .github/workflows/continuous-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Continuous Deployment

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- main

jobs:
release-plz:
name: Release-plz
runs-on: ubuntu-latest
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_KEY }}
steps:
- name: Generate token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.UNLEASH_BOT_APP_ID }}
private-key: ${{ secrets.UNLEASH_BOT_PRIVATE_KEY }}

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.generate-token.outputs.token }}
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: MarcoIeni/[email protected]
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
39 changes: 0 additions & 39 deletions .github/workflows/publish.yaml

This file was deleted.

42 changes: 21 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ license = "MIT"
actix-service = "2.0.2"
actix-web = { version = "4.9.0", default-features = false }
base64 = "0.22.1"
futures = "0.3.30"
futures = "0.3.31"
str-buf = "3.0.3"
xxhash-rust = { version = "0.8.12", features = ["xxh3"] }
xxhash-rust = { version = "0.8.15", features = ["xxh3"] }

[dev-dependencies]
actix-web = { version = "4.9.0", default-features = false, features = [
Expand Down
106 changes: 106 additions & 0 deletions release-plz.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
[workspace]

changelog_update = true

dependencies_update = true

git_tag_enable = true

git_release_enable = false

pr_labels = ["release"]

allow_dirty = false

publish_allow_dirty = false

semver_check = false


[changelog]

commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
{ message = "^dep-update", group = "<!-- 11 --> Dependency updates" },
{ message = "^build\\(deps\\)", group = "<!-- 11 --> Dependency updates" },
{ 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 = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
{ message = ".*", group = "<!-- 10 -->💼 Other" },
]

commit_preprocessors = [
# Replace `foo` with `bar`
{ pattern = "foo", replace = "bar" },

# Replace `<REPO>` in the template body with the repository URL
{ pattern = '<REPO>', replace = "https://github.com/unleash/actix-middleware-etag" },

# Replace multiple spaces with a single space.
{ pattern = " +", replace = " " },

# Replace the issue number with the link.
{ pattern = "\\(#([0-9]+)\\)", replace = "([#${1}](https://github.com/unleash/actix-middleware-etag/issues/${1}))" },
# Remove prefix
{ pattern = 'Merged PR #[0-9]: (.*)', replace = "$1" },

# Remove gitmoji from commit messages, both actual UTF emoji and :emoji:
{ pattern = ' *(:\w+:|[\p{Emoji_Presentation}\p{Extended_Pictographic}\u{200D}]) *', replace = "" },

# Hyperlink PR references from merge commits.
{ pattern = "Merge pull request #([0-9]+) from [^ ]+", replace = "PR # [${1}](https://github.com/unleash/actix-middleware-etag/pull/${1}):" },

# Hyperlink commit links, with short commit hash as description.
{ pattern = "https://github.com/unleash/actix-middleware-etag/commit/([a-f0-9]{7})[a-f0-9]*", replace = "commit # [${1}](${0})" },

# Linear issue references
{ pattern = "\\(([0-9]-[0-9]+)\\)", replace = "Linear issue: [${1}](https://linear.app/unleash/issue/${1})"},

# Hyperlink bare commit hashes like "abcd1234" in commit logs, with short commit hash as description.
{ pattern = "([ \\n])(([a-f0-9]{7})[a-f0-9]*)", replace = "${1}commit # [${3}](https://github.com/unleash/actix-middleware-etag/commit/${2})" },
]

body = """

## [{{ version | trim_start_matches(pat="v") }}]\
{%- if release_link -%}\
({{ release_link }})\
{% endif %} \
- {{ timestamp | date(format="%Y-%m-%d") }}
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits %}
{%- if commit.scope -%}
- *({{commit.scope}})* {% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message }}{{ self::username(commit=commit) }}\
{%- if commit.links %} \
({% for link in commit.links %}[{{link.text}}]({{link.href}}) {% endfor -%})\
{% endif %}
{% else -%}
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }}{{ self::username(commit=commit) }}{{ self::pr(commit=commit) }}
{% endif -%}
{% endfor -%}
{% endfor %}
{%- if remote.contributors %}
### Contributors
{% for contributor in remote.contributors %}
* @{{ contributor.username }}
{%- endfor %}
{% endif -%}
{%- macro username(commit) -%}
{% if commit.remote.username %} (by @{{ commit.remote.username }}){% endif -%}
{% endmacro -%}
{%- macro pr(commit) -%}
{% if commit.remote.pr_number %} - #{{ commit.remote.pr_number }}{% endif -%}
{% endmacro -%}
"""
Loading