Skip to content

Commit

Permalink
chore: added semantic release (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaMasych authored Oct 18, 2024
1 parent 49474f3 commit 9575961
Show file tree
Hide file tree
Showing 5 changed files with 6,578 additions and 5 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Check PR Title

on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize

jobs:
lint:
runs-on: ubuntu-latest
permissions:
statuses: write
pull-requests: write
steps:
- name: Check that PR title follows semantic commit specification
uses: amannn/action-semantic-pull-request@v5
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Inform about diverging PR title naming
uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fail, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
Hey there! 👋
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.
Examples of valid PR titles:
- feat: support new error codes
- fix(config): correct env resolution
- ci: add new workflow for linting
Details:
```
${{ steps.lint_pr_title.outputs.error_message }}
```
- name: Delete a comment if the issue resolved
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ steps.lint_pr_title.outputs.error_message == null }}
with:
header: pr-title-lint-error
delete: true
30 changes: 30 additions & 0 deletions .github/workflows/release-dry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release Dry Run

on:
pull_request:
branches:
- main

jobs:
semantic-release-dry-run:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic
with:
semantic_version: ^24.1.1
extra_plugins: |
[email protected]
dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Output Deduced Info
run: |
echo "Is new release: ${{ steps.semantic.outputs.new_release_published }}"
echo "New release version: ${{ steps.semantic.outputs.new_release_version }}"
echo "New release git tag: ${{ steps.semantic.outputs.new_release_git_tag }}"
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release

on:
push:
branches:
- main

jobs:
semantic-release:
permissions:
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: ^24.1.1
extra_plugins: |
[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Loading

0 comments on commit 9575961

Please sign in to comment.