Skip to content

Commit 53196e5

Browse files
committed
Added code for npm publishing.
1 parent 4cd82e1 commit 53196e5

File tree

5 files changed

+8212
-2390
lines changed

5 files changed

+8212
-2390
lines changed

.github/workflows/release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
issues: write
11+
pull-requests: write
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
persist-credentials: false
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: "lts/*"
27+
cache: "npm"
28+
29+
- name: Install dependencies
30+
run: npm ci
31+
32+
- name: Build
33+
run: npm run build
34+
35+
- name: Run tests
36+
run: npm test
37+
38+
- name: Release
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
run: npm run semantic-release

.releaserc.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"branches": ["main"],
3+
"analyzeCommits": "angular",
4+
"plugins": [
5+
[
6+
"@semantic-release/commit-analyzer",
7+
{
8+
"preset": "angular",
9+
"parserOpts" : {
10+
"noteKeywords": [ "BREAKING-CHANGE" ]
11+
}
12+
}
13+
],
14+
"@semantic-release/release-notes-generator",
15+
[
16+
"@semantic-release/changelog",
17+
{
18+
"changelogFile": "CHANGELOG.md"
19+
}
20+
],
21+
"@semantic-release/npm",
22+
[
23+
"@semantic-release/git",
24+
{
25+
"assets": ["CHANGELOG.md", "package.json"],
26+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
27+
}
28+
],
29+
"@semantic-release/github"
30+
],
31+
"dryRun": true
32+
}

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,12 @@ After building the cli you can install the cli globally by running the following
9999
npm install -g
100100
```
101101

102-
After that you can now execute the cli via ```patternfly-cli``` command in the terminal. We are currently in the process of moving this to npmjs once we this ready for v 1.0.0
102+
After that you can now execute the cli via ```patternfly-cli``` command in the terminal.
103+
104+
### Releasing
105+
106+
This project uses [semantic-release](https://semantic-release.gitbook.io/) to automate versioning and releases based on [Conventional Commits](https://www.conventionalcommits.org/).
107+
108+
- **CI**: Pushing to `main` runs the release workflow. If there are commits that warrant a release (e.g. `feat:`, `fix:`, `BREAKING CHANGE:`), it will create a GitHub release, update `CHANGELOG.md`, and bump the version in `package.json`.
109+
- **Local dry run**: `npx semantic-release --dry-run` (no push or publish).
110+
- **npm publish**: By default only GitHub releases are created. To publish to npm, set the `NPM_TOKEN` secret in the repo and set `"npmPublish": true` for the `@semantic-release/npm` plugin in `.releaserc.json`.

0 commit comments

Comments
 (0)