Skip to content

Commit 9575961

Browse files
authored
chore: added semantic release (#20)
1 parent 49474f3 commit 9575961

File tree

5 files changed

+6578
-5
lines changed

5 files changed

+6578
-5
lines changed

.github/workflows/check-pr-title.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Check PR Title
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- edited
9+
- synchronize
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
statuses: write
16+
pull-requests: write
17+
steps:
18+
- name: Check that PR title follows semantic commit specification
19+
uses: amannn/action-semantic-pull-request@v5
20+
id: lint_pr_title
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Inform about diverging PR title naming
25+
uses: marocchino/sticky-pull-request-comment@v2
26+
# When the previous steps fail, the workflow would stop. By adding this
27+
# condition you can continue the execution with the populated error message.
28+
if: always() && (steps.lint_pr_title.outputs.error_message != null)
29+
with:
30+
header: pr-title-lint-error
31+
message: |
32+
Hey there! 👋
33+
34+
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
35+
Examples of valid PR titles:
36+
37+
- feat: support new error codes
38+
- fix(config): correct env resolution
39+
- ci: add new workflow for linting
40+
41+
Details:
42+
43+
```
44+
${{ steps.lint_pr_title.outputs.error_message }}
45+
```
46+
47+
- name: Delete a comment if the issue resolved
48+
uses: marocchino/sticky-pull-request-comment@v2
49+
if: ${{ steps.lint_pr_title.outputs.error_message == null }}
50+
with:
51+
header: pr-title-lint-error
52+
delete: true

.github/workflows/release-dry.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Release Dry Run
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
semantic-release-dry-run:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Semantic Release
16+
uses: cycjimmy/semantic-release-action@v4
17+
id: semantic
18+
with:
19+
semantic_version: ^24.1.1
20+
extra_plugins: |
21+
22+
dry_run: true
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Output Deduced Info
27+
run: |
28+
echo "Is new release: ${{ steps.semantic.outputs.new_release_published }}"
29+
echo "New release version: ${{ steps.semantic.outputs.new_release_version }}"
30+
echo "New release git tag: ${{ steps.semantic.outputs.new_release_git_tag }}"

.github/workflows/release.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
semantic-release:
10+
permissions:
11+
contents: write
12+
issues: write
13+
pull-requests: write
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Semantic Release
20+
uses: cycjimmy/semantic-release-action@v4
21+
with:
22+
semantic_version: ^24.1.1
23+
extra_plugins: |
24+
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 commit comments

Comments
 (0)