Skip to content

Commit 6d76778

Browse files
spike-rabbitfh1ch
authored andcommitted
build: use semantic-release instead of manual release flow
1 parent 06a9fe6 commit 6d76778

File tree

9 files changed

+22361
-12439
lines changed

9 files changed

+22361
-12439
lines changed

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
build-and-test:
7+
uses: ./.github/workflows/test_and_deploy.yml
8+
secrets:
9+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
10+
11+
publish:
12+
runs-on: ubuntu-22.04
13+
needs:
14+
- build-and-test
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0 # semantic-release needs this
19+
token: ${{ secrets.ELEMENT_BOT_GITHUB_TOKEN }} # Otherwise, branch protection rules are not bypassed.
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: lts/jod
23+
cache: 'npm'
24+
- uses: actions/download-artifact@v4
25+
with:
26+
name: dist
27+
path: dist
28+
- run: npm ci --prefer-offline --no-audit
29+
- run: npx semantic-release
30+
env:
31+
GIT_AUTHOR_NAME: 'Siemens Element Bot'
32+
GIT_AUTHOR_EMAIL: '[email protected]'
33+
GIT_COMMITTER_NAME: 'Siemens Element Bot'
34+
GIT_COMMITTER_EMAIL: '[email protected]'
35+
GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_GITHUB_TOKEN }}
36+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test_and_deploy.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Build, Test, and Deploy
22

33
on:
4+
workflow_call:
5+
secrets:
6+
CC_TEST_REPORTER_ID:
7+
required: true
48
pull_request:
59
push:
610
branches:

.prettierignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Ignore artifacts:
2+
.venv
3+
build
4+
coverage
5+
dist
6+
tmp
7+
playwright/snapshots
8+
CHANGELOG.md

.releaserc.js

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import writerOpts from './tools/semantic-release/writer-opts.js';
2+
import { commitTypes, releaseRules } from './tools/semantic-release/config.js';
3+
4+
export default {
5+
tagFormat: '${version}',
6+
branches: [
7+
{
8+
name: 'maintenance/+([0-9])?(.{+([0-9]),x}).x',
9+
channel: "${name.replace(/^maintenance\\\\//g, '')}"
10+
},
11+
'main',
12+
{
13+
name: 'next',
14+
channel: 'next',
15+
prerelease: true
16+
}
17+
],
18+
plugins: [
19+
[
20+
'@semantic-release/commit-analyzer',
21+
{
22+
preset: 'angular',
23+
releaseRules,
24+
parserOpts: {
25+
noteKeywords: ['BREAKING CHANGE']
26+
},
27+
presetConfig: {
28+
types: commitTypes
29+
}
30+
}
31+
],
32+
[
33+
'@semantic-release/release-notes-generator',
34+
{
35+
preset: 'angular',
36+
parserOpts: {
37+
noteKeywords: ['BREAKING CHANGE', 'NOTE', 'DEPRECATED']
38+
},
39+
writerOpts
40+
}
41+
],
42+
'@semantic-release/changelog',
43+
// Packages to be pushed
44+
[
45+
'@semantic-release/npm',
46+
{
47+
pkgRoot: 'dist/ngx-datatable'
48+
}
49+
],
50+
// Only update remaining package.json that are not directly published
51+
[
52+
'@semantic-release/npm',
53+
{
54+
pkgRoot: 'projects/ngx-datatable',
55+
npmPublish: false
56+
}
57+
],
58+
[
59+
'@semantic-release/npm',
60+
{
61+
npmPublish: false
62+
}
63+
],
64+
[
65+
'@semantic-release/git',
66+
{
67+
assets: ['CHANGELOG.md', 'package.json', 'package-lock.json', 'projects/*/package.json'],
68+
message: 'chore(release): ${nextRelease.version}'
69+
}
70+
],
71+
'@semantic-release/github'
72+
]
73+
};

0 commit comments

Comments
 (0)