Skip to content

Commit

Permalink
ci: set up coverage, add the release and lint PR title workflows (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-bodnar authored Sep 4, 2023
1 parent f35252b commit 43e7e25
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ jobs:

- name: Unit Testing
run: yarn test:ci
# Need to register an account in Codecov
# - name: Check coverage
# uses: codecov/codecov-action@v3
# with:
# verbose: true

- name: Check coverage
uses: codecov/codecov-action@v3
with:
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
18 changes: 18 additions & 0 deletions .github/workflows/lint-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: lint-pr-title

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

jobs:
main:
runs-on: ubuntu-latest

steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release
run-name: Release ${{ github.event.inputs.version }} version

on:
workflow_dispatch:
inputs:
version:
type: choice
description: Version
options:
- patch
- minor
- major

jobs:
publish-npm:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
registry-url: https://registry.npmjs.org/

- name: Install the latest version of the npm CLI
run: npm install -g npm@latest

- name: Install dependencies and build
run: |
yarn install
yarn build
- name: Install release-it globally
run: |
npm i -g release-it
npm i -g @release-it/keep-a-changelog
- name: git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: npm config
run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}

- name: Bump version
run: npx release-it --increment ${{ github.event.inputs.version }} --ci -V
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"git": {
"push": true,
"commit": true,
"commitMessage": "chore: version ${version} [skip ci]",
"requireBranch": "main",
"tag": true
},
"github": {
"release": true,
"autoGenerate": true,
"releaseName": "${version}"
},
"npm": {
"publish": true
},
"plugins": {
"@release-it/keep-a-changelog": {
"filename": "CHANGELOG.md"
}
}
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,8 @@
"engines": {
"node": "16.x"
},
"publishConfig": {
"access": "public"
},
"license": "MIT"
}

0 comments on commit 43e7e25

Please sign in to comment.