Skip to content
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

chore: set up semantic release #80

Merged
merged 1 commit into from
Nov 8, 2023
Merged
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
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release on main

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

on:
push:
branches:
- main

# Cancel previous workflows which might still be running
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install dependencies
run: npm install

- name: Run all tests
run: npm test

- name: Release and publish
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
48 changes: 25 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
name: Run Lint and Tests

on: push
on:
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: [10.x, 12.x, 13.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: |
npm install
env:
CI: true
- name: Run tests
run: |
npm run lint && npm test
env:
CI: true
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: [10.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm install

- name: Lint
run: npm run lint

- name: Run tests
run: npm test
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,21 @@
"time-span": "^4.0.0"
},
"devDependencies": {
"@semantic-release/changelog": "6.0.3",
"@semantic-release/commit-analyzer": "11.1.0",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "9.2.1",
"@semantic-release/npm": "11.0.1",
"@semantic-release/release-notes-generator": "12.1.0",
"@sinonjs/fake-timers": "6.0.1",
"benchmark": "2.1.4",
"eslint": "7.32.0",
"eslint-config-airbnb-base": "14.2.1",
"eslint-config-prettier": "7.2.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-prettier": "3.4.1",
"@sinonjs/fake-timers": "6.0.1",
"prettier": "2.8.8",
"semantic-release": "22.0.7",
"tap": "14.11.0"
},
"repository": {
Expand Down
27 changes: 27 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
'@semantic-release/changelog',
[
'@semantic-release/npm',
{
tarballDir: 'release',
},
],
[
'@semantic-release/github',
{
assets: 'release/*.tgz',
},
],
'@semantic-release/git',
],
preset: 'angular',
branches: [
{ name: 'main' },
{ name: 'alpha', prerelease: true },
{ name: 'beta', prerelease: true },
{ name: 'next', prerelease: true },
],
};