Skip to content

Commit e14e41e

Browse files
committed
feat: add semantic release workflow
1 parent 511740f commit e14e41e

File tree

4 files changed

+72
-1
lines changed

4 files changed

+72
-1
lines changed

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
on:
3+
workflow_run:
4+
workflows: ["Unit tests"]
5+
types:
6+
- completed
7+
jobs:
8+
release:
9+
name: Release (${{ github.event.workflow_run.head_commit.id }})
10+
if: ${{ github.ref_name == 'main' && github.event.workflow_run.conclusion == 'success' }}
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: "lts/*"
21+
registry-url: 'https://registry.npmjs.org'
22+
- name: Install package dependencies
23+
run: yarn install
24+
- name: Build package
25+
run: yarn run build
26+
- name: Install semantic release extras
27+
run: yarn add -D @semantic-release/changelog @semantic-release/git conventional-changelog-conventionalcommits
28+
- name: Semantic Release
29+
id: semantic
30+
uses: cycjimmy/semantic-release-action@v3
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
- name: Publish
34+
run: yarn publish
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37+
if: steps.semantic.outputs.new_release_published == 'true'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules
44
dist
55
coverage
66
yarn.lock
7+
!release.config.js

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"pulumi"
1818
],
1919
"author": "Mathew Topper <damm_horse@yahoo.co.uk>",
20-
"version": "0.1.0",
20+
"version": "0.0.0-semantic-release",
2121
"main": "dist/index.js",
2222
"types": "dist/index.d.ts",
2323
"bin": {

release.config.js

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

0 commit comments

Comments
 (0)