Skip to content

Commit 1fbee29

Browse files
authored
Merge pull request #60 from morukele/dev
chore(ci): updated automatic release github action
2 parents 068eee4 + 79ef15b commit 1fbee29

4 files changed

Lines changed: 25 additions & 50 deletions

File tree

.github/workflows/PR.yml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,3 @@ jobs:
3535
run: cargo build --verbose
3636
- name: Run tests
3737
run: cargo test --verbose
38-
39-
- uses: actions/checkout@v3
40-
with:
41-
fetch-depth: 0 # required for git-cliff
42-
43-
- name: Install git-cliff
44-
run: cargo install git-cliff
45-
46-
- name: Generate changelog
47-
run: git-cliff -o CHANGELOG.md
48-
49-
- name: Commit changelog
50-
run: |
51-
git config user.name "GitHub Actions"
52-
git config user.email "actions@github.com"
53-
git add CHANGELOG.md
54-
git commit -m "chore: update changelog for release" || echo "no changes"
55-
56-
- name: Push changelog
57-
run: git push origin main || echo "no changes"

.github/workflows/release.yml

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
name: Release
1+
name: Release Crate
22

33
on:
44
workflow_dispatch:
55
inputs:
66
level:
77
description: "Release level (patch, minor, major)"
88
required: true
9+
default: patch
910
type: choice
1011
options:
1112
- patch
@@ -14,40 +15,27 @@ on:
1415

1516
jobs:
1617
release:
17-
name: Release Crate
18+
name: Cargo Release
1819
runs-on: ubuntu-latest
1920
permissions:
20-
contents: write
21+
contents: write # for pushing tags/commits
2122
steps:
22-
- name: Checkout branch
23+
- name: Checkout code
2324
uses: actions/checkout@v3
2425
with:
2526
token: ${{ secrets.GH_PAT }}
26-
fetch-depth: 0 # required for git-cliff
27+
fetch-depth: 0 # required for tagging and changelog
2728

28-
- name: Configure Git
29+
- name: Setup Git identity
2930
run: |
3031
git config --global user.name "github-actions[bot]"
3132
git config --global user.email "github-actions[bot]@users.noreply.github.com"
3233
33-
- name: Install dependencies
34-
run: |
35-
cargo install cargo-release
36-
cargo install git-cliff
37-
38-
- name: Generate Changelog
39-
run: |
40-
git cliff -o CHANGELOG.md
34+
- name: Install cargo-release
35+
run: cargo install cargo-release
4136

42-
- name: Commit Changelog
43-
run: |
44-
git add CHANGELOG.md
45-
git commit -m "chore(changelog): update CHANGELOG.md for release" || echo "No changes to commit"
46-
git push origin HEAD
47-
48-
- name: Perform Release
49-
run: |
50-
LEVEL="${{ github.event.inputs.level}}"
51-
cargo release $LEVEL --execute --no-confirm
37+
- name: Run cargo-release
5238
env:
53-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN}}
39+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
40+
run: |
41+
cargo release ${{ github.event.inputs.level }} --execute --no-confirm

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [unreleased] - ReleaseDate
5+
## [1.2.0] - 2025-06-28
66

77
### ⚙️ Miscellaneous Tasks
88

release.toml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
pre-release-replacements = [
2-
{ file = "CHANGELOG.md", search = "unreleased", replace = "{{version}}" },
3-
{ file = "CHANGELOG.md", search = "ReleaseDate", replace = "{{date}}" },
2+
{ file = "README.md", search = "^paystack-rs = \".*\"$", replace = "{{crate_name}} = \"{{version}}\"" },
3+
{ file = "src/lib.rs", search = "^//! paystack-rs = \".*\"$", replace = "//! {{crate_name}} = \"{{version}}\"" },
4+
]
5+
pre-release-hook = [
6+
"git",
7+
"cliff",
8+
"-o",
9+
"CHANGELOG.md",
10+
"--tag",
11+
"{{version}}",
412
]
513

6-
# Configure the release process
714
[release]
815
sign-commit = false
916
sign-tag = false
@@ -12,4 +19,4 @@ publish = true
1219
allow-branch = ["main"]
1320
consolidate-commits = false
1421
changelog = true
15-
changelog_command = "git cliff -o CHANGELOG.md -n"
22+
changelog_command = "cargo release changelog"

0 commit comments

Comments
 (0)