Skip to content

Commit fa5025d

Browse files
committed
feat: add semantic-release workflow
1 parent cc6c378 commit fa5025d

File tree

6 files changed

+648
-1090
lines changed

6 files changed

+648
-1090
lines changed

.github/workflows/release.yml

Lines changed: 58 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,73 @@ name: Release
22

33
on:
44
push:
5-
tags:
6-
- "v*"
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: write # to be able to publish a GitHub release
14+
issues: write # to be able to comment on released issues
15+
pull-requests: write # to be able to comment on released pull requests
16+
id-token: write # to enable use of OIDC for trusted publishing and npm provenance
717

818
jobs:
9-
release:
19+
validate:
20+
name: 🔍 Validate
1021
runs-on: ubuntu-latest
11-
permissions:
12-
contents: write
13-
id-token: write
1422
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v4
23+
- name: ⬇️ Checkout repo
24+
uses: actions/checkout@v5
1725

18-
- name: Setup Node.js
19-
uses: actions/setup-node@v4
26+
- name: Setup node
27+
uses: actions/setup-node@v6
2028
with:
21-
node-version: "20"
22-
cache: "npm"
23-
registry-url: "https://registry.npmjs.org"
29+
node-version: lts/*
2430

25-
- name: Install dependencies
26-
run: npm ci
31+
- name: 📥 Download deps
32+
uses: bahmutov/npm-install@v1
33+
with:
34+
useLockFile: false # better for libraries
2735

28-
- name: Validate package
36+
- name: 🔍 Validate
2937
run: npm run validate
3038

31-
- name: Publish to npm
32-
run: npm publish --provenance --access public
33-
env:
34-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35-
36-
- name: Generate release notes
37-
id: release_notes
38-
run: |
39-
# Extract version from tag
40-
VERSION=${GITHUB_REF#refs/tags/v}
41-
echo "version=$VERSION" >> $GITHUB_OUTPUT
42-
43-
# Generate changelog since last tag
44-
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
45-
if [ -n "$PREV_TAG" ]; then
46-
echo "## Changes" > release_notes.md
47-
git log --pretty=format:"- %s (%h)" $PREV_TAG..HEAD >> release_notes.md
48-
else
49-
echo "## Initial Release" > release_notes.md
50-
echo "First release of @aha-co/config" >> release_notes.md
51-
fi
52-
53-
- name: Create GitHub Release
54-
uses: actions/create-release@v1
39+
release:
40+
name: 🚀 Release
41+
needs: [validate]
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: ⬇️ Checkout repo
45+
uses: actions/checkout@v5
46+
47+
- name: ⎔ Setup node
48+
uses: actions/setup-node@v6
49+
with:
50+
node-version: lts/*
51+
52+
- name: 📥 Download deps
53+
uses: bahmutov/npm-install@v1
54+
with:
55+
useLockFile: false # better for libraries
56+
57+
- name: ✍️ Verify signatures
58+
run: npm audit signatures
59+
60+
- name: 🚀 Release
61+
uses: cycjimmy/semantic-release-action@v6
62+
with: semantic_version: 25
63+
branches: |
64+
[
65+
'+([0-9])?(.{+([0-9]),x}).x',
66+
'main',
67+
'next',
68+
'next-major',
69+
{name: 'beta', prerelease: true},
70+
{name: 'alpha', prerelease: true}
71+
]
5572
env:
5673
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57-
with:
58-
tag_name: ${{ github.ref }}
59-
release_name: Release ${{ steps.release_notes.outputs.version }}
60-
body_path: release_notes.md
61-
draft: false
62-
prerelease: ${{ contains(github.ref, '-') }}
74+
NPM_CONFIG_PROVENANCE: true

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</a>
1111
</div>
1212

13-
# @aha-co/config
13+
# @theahaco/ts-config
1414

1515
Standardized set of configuration files for TypeScript projects so we don't have
1616
to think about them. Heavily inspired by
@@ -22,7 +22,7 @@ These are a set of defaults and everything can be overridden as needed per
2222
project.
2323

2424
```
25-
npm install @aha-co/config
25+
npm install @theahaco/ts-config
2626
```
2727

2828
### TypeScript
@@ -32,7 +32,7 @@ Create a `tsconfig.json` file in the project root and
3232

3333
```json
3434
{
35-
"extends": ["@aha-co/config/typescript"],
35+
"extends": ["@theahaco/ts-config/typescript"],
3636
"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
3737
"compilerOptions": {
3838
// override here
@@ -43,7 +43,7 @@ Create a `tsconfig.json` file in the project root and
4343
Create a `reset.d.ts` file:
4444

4545
```ts
46-
import "@aha-co/config/reset.d.ts"
46+
import "@theahaco/ts-config/reset.d.ts"
4747
```
4848

4949
#### TS for Libraries
@@ -54,7 +54,7 @@ be consumable in as many setups as possible. You can extend a different config
5454
instead:
5555

5656
```json
57-
extends: ["@aha-co/config/typescript.lib"],
57+
extends: ["@theahaco/ts-config/typescript.lib"],
5858
```
5959

6060
### ESLint
@@ -63,7 +63,7 @@ Create a `eslint.config.js` file in the project root and
6363
[extend this config file](https://eslint.org/docs/latest/extend/shareable-configs#overriding-settings-from-shareable-configs):
6464

6565
```js
66-
import { config } from "@aha-co/config/eslint"
66+
import { config } from "@theahaco/ts-config/eslint"
6767

6868
/** @type {import("eslint").Linter.Config[]} */
6969
export default [
@@ -77,7 +77,7 @@ export default [
7777
Add a line in `package.json` to point to this config file:
7878

7979
```json
80-
"prettier": "@aha-co/config/prettier",
80+
"prettier": "@theahaco/ts-config/prettier",
8181
```
8282

8383
You can add a `.prettierignore` file to your project root if needed.

index.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/**
2-
* @aha-co/config main entry point
2+
* @theahaco/ts-config main entry point
33
*
4-
* This package provides standardized configurations for Aha JS projects.
5-
* The main entry point intentionally throws an error as there is no default export.
6-
* Import specific configurations using the named exports instead:
4+
* This package provides standardized configurations for Aha TypeScript and JavaScript
5+
* projects. The main entry point intentionally throws an error as there is no default
6+
* export. Import specific configurations using the named exports instead:
77
*
88
* @example
99
* ```ts
10-
* import { config as prettierConfig } from '@aha-co/config/prettier'
11-
* import { config as eslintConfig } from '@aha-co/config/eslint'
10+
* import { config as prettierConfig } from '@theahaco/ts-config/prettier'
11+
* import { config as eslintConfig } from '@theahaco/ts-config/eslint'
1212
* ```
1313
*/
1414

0 commit comments

Comments
 (0)