Skip to content

Commit

Permalink
feat(action): add support for semantic-release
Browse files Browse the repository at this point in the history
Add a job in the GitHub CI workflow to automatically tag commits in the
main and develop branches, based on the commit message headers. As long
as the commit messages follow the Conventional Commits specification,
semantic-release should be able to identify them and create new releases
using Git tags.

Releases are only created on the main and develop branches. Releases in
the develop branch are marked as pre-release.

The workflow was also renamed to something more generic, since it no
longer exclusively runs pre-commit.

Associated issue: ShahradR/git-template#8
  • Loading branch information
ShahradR committed Jul 1, 2020
1 parent 1c02cc0 commit 2c0f7dc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: pre-commit
name: CI workflow

on: [push, pull_request]

jobs:
pre-commit:
name: Run pre-commit checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -16,3 +17,18 @@ jobs:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- uses: pre-commit/action@v1.1.0

release:
name: Create release
runs-on: ubuntu-latest
needs: [pre-commit]
if: ${{ needs.pre-commit.result == 'success' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2.1.0
with:
node-version: 12
- name: Release
run: npx semantic-release
11 changes: 11 additions & 0 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
branches:
- main
- name: develop
prerelease: true

plugins:
- "@semantic-release/github"
- "@semantic-release/commit-analyzer":
preset: conventionalcommits
- "@semantic-release/release-notes-generator"

0 comments on commit 2c0f7dc

Please sign in to comment.