Skip to content

Commit

Permalink
chore: set up semantic release and GH workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
wkillerud committed Jun 25, 2024
1 parent 3824adf commit a6c4576
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 2 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release and Publish

on:
push:
branches:
- master
- alpha
- beta
- next

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: npm install
run: npm install

- name: npm lint
run: npm run lint

- name: npm test
run: npm test

- name: Typecheck
run: npm run types

release:
name: Release
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: npm install
run: npm install

- name: Generate type definitions
run: npm run types

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

on: push

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: npm install

- name: npm lint
run: npm run lint

- name: npm test
run: npm test

- name: Typecheck
run: npm run types
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "tap --disable-coverage --allow-empty-coverage test/*.js && tsc --project tsconfig.test.json",
"test": "tsc --project tsconfig.test.json",
"types": "tsc --declaration --emitDeclarationOnly"
},
"author": "Trygve Lie",
Expand All @@ -39,13 +39,18 @@
"server-destroy": "1.0.1"
},
"devDependencies": {
"@semantic-release/changelog": "6.0.3",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "10.0.6",
"@semantic-release/npm": "12.0.1",
"@semantic-release/release-notes-generator": "14.0.1",
"@types/readable-stream": "^4.0.14",
"eslint": "9.5.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.1.3",
"globals": "15.0.0",
"prettier": "3.3.2",
"tap": "19.2.5",
"semantic-release": "24.0.0",
"typescript": "5.5.2"
}
}
27 changes: 27 additions & 0 deletions release.config.cjs
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: 'master' },
{ name: 'alpha', prerelease: true },
{ name: 'beta', prerelease: true },
{ name: 'next', prerelease: true },
],
};

0 comments on commit a6c4576

Please sign in to comment.