Skip to content

Commit 7ee997b

Browse files
committed
chore: add semantic release GH action
1 parent 3242315 commit 7ee997b

9 files changed

+201
-89
lines changed

.github/CONTRIBUTING.md

+31
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,37 @@ This project adheres to the Adobe [code of conduct](../CODE_OF_CONDUCT.md). By p
1010
you are expected to uphold this code. Please report unacceptable behavior to
1111
1212

13+
## Release
14+
- based on Angular Commit Message Conventions in commits -
15+
https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit-message-header
16+
- Commit message format is used to build:
17+
* Release notes
18+
* Changelog updates
19+
* NPM package semver
20+
21+
## Commit message Convention
22+
23+
```
24+
<type>(<scope>): <short summary>
25+
│ │ │
26+
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
27+
│ │
28+
│ └─⫸ Commit Scope (optional): project|based|list
29+
30+
└─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test
31+
```
32+
33+
34+
### Major Version Release:
35+
36+
In order to trigger Major Version upgrade, `BREAKING CHANGE:` needs to be in the footer of a commit message:
37+
38+
```
39+
<type>(<scope>): <short summary>
40+
<BLANK LINE>
41+
BREAKING CHANGE: <breaking change summary>
42+
```
43+
1344
## Have A Question?
1445

1546
Start by filing an issue. The existing committers on this project work to reach

.github/workflows/ci.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
branches: [ $default-branch ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ${{ matrix.os }}
13+
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest]
17+
node-version: [20.x]
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Setup Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
- name: Install dependencies
27+
run: npm ci
28+
- name: Build Library
29+
run: npm run build --if-present
30+
- name: Run Tests
31+
run: npm test --if-present

.github/workflows/manual-release.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Manual Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: 'Version'
7+
type: choice
8+
required: true
9+
default: fix
10+
options:
11+
- fix
12+
- feat
13+
- BREAKING CHANGE
14+
dryRun:
15+
description: 'DryRun'
16+
type: boolean
17+
default: true
18+
# ENV and Config
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
22+
GIT_AUTHOR_NAME: github-actions
23+
GIT_AUTHOR_EMAIL: [email protected]
24+
GIT_COMMITTER_NAME: github-actions
25+
GIT_COMMITTER_EMAIL: [email protected]
26+
CI: true
27+
CONFIG_NODE_VERSION: '["20.x"]'
28+
CONFIG_OS: '["ubuntu-latest"]'
29+
# Main Job
30+
jobs:
31+
config:
32+
runs-on: ubuntu-latest
33+
outputs:
34+
NODE_VERSION: ${{ steps.set-config.outputs.CONFIG_NODE_VERSION }}
35+
OS: ${{ steps.set-config.outputs.CONFIG_OS }}
36+
steps:
37+
- id: set-config
38+
run: |
39+
echo "CONFIG_NODE_VERSION=${{ toJSON(env.CONFIG_NODE_VERSION) }}" >> $GITHUB_OUTPUT
40+
echo "CONFIG_OS=${{ toJSON(env.CONFIG_OS) }}" >> $GITHUB_OUTPUT
41+
release:
42+
name: Test, Build and force Release
43+
needs: config
44+
45+
runs-on: ${{ matrix.OS }}
46+
strategy:
47+
matrix:
48+
OS: ${{ fromJSON(needs.config.outputs.OS) }}
49+
NODE_VERSION: ${{ fromJSON(needs.config.outputs.NODE_VERSION) }}
50+
51+
steps:
52+
- name: Checkout repo
53+
uses: actions/checkout@v4
54+
- name: Setup Node.js ${{ matrix.NODE_VERSION }}
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version: ${{ matrix.NODE_VERSION }}
58+
- name: Commit trigger
59+
run: |
60+
git commit --allow-empty -m "${{ github.event.inputs.version }}: Trigger Manual Release
61+
62+
${{ github.event.inputs.version }}:Forced Manual Release without code changes"
63+
- name: Install dependencies
64+
run: npm ci
65+
- name: Build Library
66+
run: npm run build --if-present
67+
- name: Run Tests
68+
run: npm test --if-present
69+
- name: Publish npm package
70+
uses: cycjimmy/semantic-release-action@v4
71+
with:
72+
dry_run: ${{ github.event.inputs.dryRun == 'true' }}
73+
extra_plugins: |
74+
@semantic-release/changelog
75+
@semantic-release/git

.github/workflows/nodejs.yml

-27
This file was deleted.

.github/workflows/on-push-publish-to-npm.yml

-20
This file was deleted.

.github/workflows/release.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
name: Test, Build and Release
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ ubuntu-latest ]
15+
node-version: [ 20.x ]
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: ${{ matrix['node-version'] }}
24+
- name: Install dependencies
25+
run: npm ci
26+
- name: Build Library
27+
run: npm run build --if-present
28+
- name: Run Tests
29+
run: npm test --if-present
30+
- name: Release
31+
uses: cycjimmy/semantic-release-action@v4
32+
with:
33+
dry_run: true
34+
extra_plugins: |
35+
@semantic-release/changelog
36+
@semantic-release/git
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
40+
GIT_AUTHOR_NAME: github-actions
41+
GIT_AUTHOR_EMAIL: [email protected]
42+
GIT_COMMITTER_NAME: github-actions
43+
GIT_COMMITTER_EMAIL: [email protected]
44+
CI: true

.github/workflows/version-bump-publish.yml

-42
This file was deleted.

.releaserc

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
[
7+
"@semantic-release/changelog",
8+
{
9+
"changelogFile": "docs/CHANGELOG.md"
10+
}
11+
],
12+
"@semantic-release/npm",
13+
[
14+
"@semantic-release/git",
15+
{
16+
"assets": ["docs/CHANGELOG.md", "package.json"]
17+
}
18+
]
19+
]
20+
}

docs/CHANGELOG.md

Whitespace-only changes.

0 commit comments

Comments
 (0)