Skip to content

Commit 270ea17

Browse files
authored
Merge pull request #2 from nkmr-jp/develp
Develp
2 parents edc93bf + 3a016e3 commit 270ea17

23 files changed

+14301
-12
lines changed

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- main
7+
jobs:
8+
release:
9+
name: Release
10+
runs-on: ubuntu-18.04
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: 12
20+
- name: Generate Release Note Template
21+
working-directory: ./.release
22+
run: |
23+
npm install
24+
- name: Release
25+
working-directory: ./.release
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: |
29+
npx semantic-release

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
build
1+
build
2+
.playground

.playground/.gitkeep

Whitespace-only changes.

.release/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.release/.releaserc.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// in ".releaserc.js" or "release.config.js"
2+
3+
const fs = require('fs');
4+
const path = require('path')
5+
const {promisify} = require('util')
6+
const dateFormat = require('dateformat')
7+
const readFileAsync = promisify(require('fs').readFile)
8+
9+
const templateDir = "./"
10+
const template = readFileAsync(path.join(templateDir, 'release-template.hbs'))
11+
const commitTemplate = readFileAsync(path.join(templateDir, 'commit-template.hbs'))
12+
const semverObj = JSON.parse(fs.readFileSync('./semver.json', 'utf8'));
13+
14+
const releaseRules = {
15+
major: convert(semverObj.semver.major),
16+
minor: convert(semverObj.semver.minor),
17+
patch: convert(semverObj.semver.patch)
18+
}
19+
20+
function convert(arr){
21+
const res=[]
22+
for (const v of arr) {
23+
res.push(`:${v}:`)
24+
}
25+
return res
26+
}
27+
28+
const releaseNotes = {
29+
template,
30+
partials: {commitTemplate},
31+
helpers: {
32+
datetime: function (format = 'UTC:yyyy-mm-dd') {
33+
return dateFormat(new Date(), format)
34+
},
35+
shortDate: function (date) {
36+
// See: https://www.npmjs.com/package/dateformat/v/3.0.0
37+
return dateFormat(date, 'mmm dd')
38+
},
39+
releaseTypeText: function (type) {
40+
if (type === 'major'){
41+
return "Breaking Release!"
42+
}
43+
if (type === 'minor'){
44+
return "Feature Release!"
45+
}
46+
if (type === 'patch'){
47+
return "Patch Release"
48+
}
49+
},
50+
releaseTypeEmoji: function (type) {
51+
if (type === 'major'){
52+
return ":confetti_ball: "
53+
}
54+
if (type === 'minor'){
55+
return ":star2: "
56+
}
57+
if (type === 'patch'){
58+
return ""
59+
}
60+
},
61+
},
62+
issueResolution: {
63+
template: '{baseUrl}/{owner}/{repo}/issues/{ref}',
64+
baseUrl: 'https://github.com',
65+
source: 'github.com'
66+
}
67+
}
68+
69+
module.exports = {
70+
branches: semverObj.branches,
71+
plugins: [
72+
['semantic-release-gitmoji', {releaseRules, releaseNotes}],
73+
'@semantic-release/github'
74+
]
75+
}

.release/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# .release
2+
3+
Check Next Release
4+
5+
```sh
6+
npm install
7+
npx semantic-release
8+
```
9+

.release/commit-template.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{subject}} - [`{{commit.short}}`](https://github.com/{{owner}}/{{repo}}/commit/{{commit.short}}) `{{shortDate committerDate}}`

0 commit comments

Comments
 (0)