build(*): Enable github actions releases

This commit is contained in:
Josh Creek
2026-03-05 21:47:35 +00:00
parent 0433fe5c2c
commit cd7ac1286c
10 changed files with 2817 additions and 9 deletions
+43
View File
@@ -0,0 +1,43 @@
name: CI
on:
pull_request:
branches:
- main
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
validate:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up pnpm
uses: pnpm/action-setup@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Validate conventional commits
run: pnpm commitlint --from "${{ github.event.pull_request.base.sha }}" --to "${{ github.event.pull_request.head.sha }}" --verbose
- name: Typecheck Svelte package
run: pnpm --filter tech-radar-editor check
- name: Build workspace
run: pnpm -r build
+48
View File
@@ -0,0 +1,48 @@
name: Release
on:
push:
branches:
- main
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up pnpm
uses: pnpm/action-setup@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Typecheck Svelte package
run: pnpm --filter tech-radar-editor check
- name: Build workspace
run: pnpm -r build
- name: Publish packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pnpm release
+17 -5
View File
@@ -143,6 +143,7 @@ editor.addEventListener('radar-data-change', (e) => {
```bash ```bash
pnpm install pnpm install
pnpm check
pnpm build pnpm build
``` ```
@@ -152,11 +153,22 @@ To develop the web component with hot reload:
pnpm dev pnpm dev
``` ```
To publish the packages to npm: ## Release Automation
Releases are now automated with GitHub Actions and `semantic-release`.
- Every commit merged to `main` must follow the [Conventional Commits](https://www.conventionalcommits.org/) format.
- `fix:` triggers a patch release, `feat:` triggers a minor release, and `BREAKING CHANGE:` or `!` triggers a major release.
- Only packages with changes since their last tag are published, so the three packages version independently.
The release workflow expects an `NPM_TOKEN` repository secret with publish access to:
- `tech-radar-editor`
- `tech-radar-editor-backend`
- `tech-radar-editor-backstage`
To preview what the release job would do locally after installing dependencies:
```bash ```bash
pnpm build pnpm release:dry-run
cd packages/tech-radar-editor && npm publish
cd packages/tech-radar-editor-backend && npm publish
cd packages/tech-radar-editor-backstage && npm publish
``` ```
+6
View File
@@ -0,0 +1,6 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'subject-case': [0],
},
};
+17 -1
View File
@@ -1,10 +1,26 @@
{ {
"private": true, "private": true,
"packageManager": "pnpm@10.30.1",
"scripts": { "scripts": {
"build": "pnpm -r build", "build": "pnpm -r build",
"dev": "pnpm --filter tech-radar-editor dev" "check": "pnpm --filter tech-radar-editor check",
"commitlint": "commitlint",
"dev": "pnpm --filter tech-radar-editor dev",
"release": "pnpm -r --workspace-concurrency=1 --filter './packages/*' exec semantic-release",
"release:dry-run": "pnpm -r --workspace-concurrency=1 --filter './packages/*' exec semantic-release --dry-run"
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
},
"devDependencies": {
"@commitlint/cli": "^20.4.3",
"@commitlint/config-conventional": "^20.4.3",
"@semantic-release/commit-analyzer": "^13.0.1",
"@semantic-release/github": "^12.0.6",
"@semantic-release/npm": "^13.1.5",
"@semantic-release/release-notes-generator": "^14.1.0",
"conventional-changelog-conventionalcommits": "^9.3.0",
"semantic-release": "^25.0.3",
"semantic-release-monorepo": "^8.0.2"
} }
} }
@@ -16,6 +16,12 @@
}, },
"author": "Josh Creek", "author": "Josh Creek",
"license": "GPL-3.0", "license": "GPL-3.0",
"release": {
"extends": [
"../../release.config.cjs",
"semantic-release-monorepo"
]
},
"scripts": { "scripts": {
"build": "tsc" "build": "tsc"
}, },
@@ -13,6 +13,12 @@
}, },
"author": "Josh Creek", "author": "Josh Creek",
"license": "GPL-3.0", "license": "GPL-3.0",
"release": {
"extends": [
"../../release.config.cjs",
"semantic-release-monorepo"
]
},
"scripts": { "scripts": {
"build": "tsc" "build": "tsc"
}, },
+6
View File
@@ -20,6 +20,12 @@
], ],
"author": "Josh Creek", "author": "Josh Creek",
"license": "GPL-3.0", "license": "GPL-3.0",
"release": {
"extends": [
"../../release.config.cjs",
"semantic-release-monorepo"
]
},
"main": "dist/tech-radar-editor.umd.js", "main": "dist/tech-radar-editor.umd.js",
"module": "dist/tech-radar-editor.es.js", "module": "dist/tech-radar-editor.es.js",
"types": "dist/main.d.ts", "types": "dist/main.d.ts",
+2659 -3
View File
File diff suppressed because it is too large Load Diff
+9
View File
@@ -0,0 +1,9 @@
module.exports = {
branches: ['main'],
plugins: [
['@semantic-release/commit-analyzer', { preset: 'conventionalcommits' }],
['@semantic-release/release-notes-generator', { preset: 'conventionalcommits' }],
'@semantic-release/npm',
'@semantic-release/github',
],
};