Skip to content

Commit 5843a6a

Browse files
committed
fix: Add gh workflow to automatic
1 parent e635b6a commit 5843a6a

File tree

4 files changed

+11262
-0
lines changed

4 files changed

+11262
-0
lines changed

Diff for: .github/workflows/add-release-and-publish.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: make-release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
persist-credentials: false
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: '18'
24+
registry-url: 'https://registry.npmjs.org'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Make Release
30+
run: npx semantic-release
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
33+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34+
35+
# - name: Publish
36+
# run: npm publish
37+
# env:
38+
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

Diff for: .releaserc.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const ref = process.env.GITHUB_REF;
2+
const branch = ref.split('/').pop();
3+
4+
function getPlugins() {
5+
if (branch === 'master') {
6+
return [
7+
'@semantic-release/commit-analyzer',
8+
'@semantic-release/release-notes-generator',
9+
['@semantic-release/changelog', { changelogFile: 'CHANGELOG.md' }],
10+
['@semantic-release/npm'],
11+
['@semantic-release/git', {
12+
assets: ['CHANGELOG.md', 'package.json'],
13+
message: '${nextRelease.version} CHANGELOG [skip ci]\n\n${nextRelease.notes}',
14+
}],
15+
'@semantic-release/github',
16+
];
17+
}
18+
19+
return [
20+
'@semantic-release/commit-analyzer',
21+
'@semantic-release/release-notes-generator',
22+
['@semantic-release/npm'],
23+
['@semantic-release/git', {
24+
assets: ['package.json'],
25+
message: '${nextRelease.version} CHANGELOG [skip ci]\n\n${nextRelease.notes}',
26+
}],
27+
'@semantic-release/github',
28+
];
29+
}
30+
31+
module.exports = {
32+
branches: [
33+
'master',
34+
{ name: 'dev', prerelease: true, },
35+
],
36+
plugins: getPlugins(),
37+
}

0 commit comments

Comments
 (0)