Skip to content

Commit 666b6fc

Browse files
author
Edmo Lima
committed
chore: update cd task
1 parent d164f64 commit 666b6fc

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

.github/workflows/cd.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
push:
55
tags:
66
- 'v*.*.*'
7+
workflow_dispatch:
8+
inputs:
9+
release-type:
10+
description: 'Release type (major, minor, patch)'
11+
required: false
12+
default: 'patch'
713

814
jobs:
915
release:
@@ -28,13 +34,36 @@ jobs:
2834
run: cargo fmt -- --check
2935
- name: Lint
3036
run: cargo clippy -- -D warnings
37+
- name: Run tests
38+
run: cargo test --all --verbose
39+
- name: Generate code coverage
40+
run: |
41+
cargo install cargo-tarpaulin
42+
cargo tarpaulin --out Xml
43+
- name: Upload coverage to Codecov
44+
uses: codecov/codecov-action@v4
45+
with:
46+
files: ./tarpaulin-report.xml
47+
fail_ci_if_error: true
3148
- name: Install cargo-release
3249
run: cargo install cargo-release
3350
- name: Run cargo-release (version bump, changelog, tag)
3451
env:
3552
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
3653
run: |
37-
cargo release --execute --no-publish
54+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
55+
cargo release ${{ github.event.inputs.release-type }} --execute --no-publish;
56+
else
57+
cargo release --execute --no-publish;
58+
fi
59+
- name: Create GitHub Release with changelog
60+
uses: softprops/action-gh-release@v2
61+
with:
62+
tag_name: ${{ github.ref_name }}
63+
name: Release ${{ github.ref_name }}
64+
body_path: CHANGELOG.md
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3867
- name: Publish to crates.io
3968
env:
4069
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 commit comments

Comments
 (0)