Skip to content

ci: semantic releases #335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 49 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,35 @@ on:

jobs:
lint:
name: Javascript standard lint
name: Lint commit messages and code
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
show-progress: false
fetch-depth: 0

- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm clean-install
- run: npm run lint

- name: Install npm dependencies
run: npm clean-install

- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: npx commitlint --last --verbose

- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

- name: Lint code
run: npm run lint

unittest:
name: unit tests
Expand Down Expand Up @@ -60,3 +73,36 @@ jobs:
with:
path: './coverage/lcov.info'
min_coverage: 95

release:
name: Release
concurrency: release
if: ${{ github.event_name == 'push' && github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
needs: [lint, unittest]
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
- name: Install dependencies
run: npm clean-install
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures
- name: Release
env:
NPM_CONFIG_PROVENANCE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Changelog
# Changelog

## 5.0.0

Expand Down
7 changes: 7 additions & 0 deletions commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
extends: ['@commitlint/config-conventional'],
rules: {
// disable max body line length - otherwise dependabot can error
'body-max-line-length': [0],
},
};
Loading
Loading