Skip to content

Commit 806274c

Browse files
authored
Merge pull request #8 from nkmr-jp/develop
Develop
2 parents 3932761 + c03c993 commit 806274c

File tree

9 files changed

+46
-22
lines changed

9 files changed

+46
-22
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ jobs:
2626
yq --version
2727
- name: Install gitmoji-semver
2828
run: |
29-
git clone https://github.com/nkmr-jp/gitmoji-semver -b v1.6.0
29+
git clone https://github.com/nkmr-jp/gitmoji-semver -b develop
3030
- name: Generate semantic-release configs
3131
working-directory: ./gitmoji-semver
3232
run: |
33-
make scaffold V=v3.0.0 F=../.semver.yml O=..
33+
make scaffold V=v3.0.0 F=../.semver.yml O=.. T=simple
3434
- name: Release
3535
working-directory: ./.release
3636
env:

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ F=.semver.yml
55
SEMVER_FILE=$(F)
66
O=./
77
OUT_DIR=$(O)
8+
T=""
9+
TEMPLATE_TYPE=$(T)
810

911
BASE_FILE=https://raw.githubusercontent.com/carloscuesta/gitmoji/$(GITMOJI_VERSION)/src/data/gitmojis.json
1012

@@ -35,11 +37,13 @@ help:
3537
@echo " V=<version> $(BLUE)Specify the base gitmoji version$(RESET)"
3638
@echo " F=<filepath> $(BLUE)Specify .semver.yml file path$(RESET)"
3739
@echo " O=<output dir> $(BLUE)Specify semantic-release setting files output directory$(RESET)"
40+
@echo " T=<template type> $(BLUE)Specify release template type 'default or simple'$(RESET)"
3841
@echo
3942
@echo "$(GREEN)Examples:$(RESET)"
4043
@echo " make gen V=v3.0.0 F=./.semver.yml"
4144
@echo " make list"
4245
@echo " make scaffold V=v3.0.0 F=./.semver.yml O=./.playground"
46+
@echo " make scaffold V=v3.0.0 F=./.semver.yml O=./.playground T=simple"
4347
@echo
4448

4549
# Generate gitmojis.json with semver field
@@ -87,12 +91,17 @@ list:
8791
scaffold: gen
8892
@echo
8993
@echo "$(PURPLE)# SCAFFOLD: Generate semantic-release setting files$(RESET)"
90-
node gen-release-template.js
94+
node gen-release-template.js $(TEMPLATE_TYPE)
9195
mkdir -p $(OUT_DIR)/.release
9296
cp -a ./semantic-release-template/. $(OUT_DIR)/.release
9397
cp ./build/dist/release-template.hbs $(OUT_DIR)/.release
9498
cp ./build/dist/gitmojis.json $(OUT_DIR)/.release
9599
cp ./build/src/semver.json $(OUT_DIR)/.release
100+
ifeq ($(TEMPLATE_TYPE),simple)
101+
cp $(OUT_DIR)/.release/commit-template-simple.hbs $(OUT_DIR)/.release/commit-template.hbs
102+
else
103+
cp $(OUT_DIR)/.release/commit-template-default.hbs $(OUT_DIR)/.release/commit-template.hbs
104+
endif
96105
@echo
97106
@echo "$(LIGHTPURPLE)🎉 Add semantic-release setting files$(RESET)"
98107
@echo $(OUT_DIR)/.release

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<!-- code_chunk_output -->
1919

2020
- [Features](#features)
21+
- [Release template type](#release-template-type)
2122
- [How to use in Mac](#how-to-use-in-mac)
2223
- [Install](#install)
2324
- [Usage](#usage)
@@ -32,17 +33,22 @@
3233

3334
<!-- /code_chunk_output -->
3435

35-
3636
## Features
37-
- :smile: A simple script to add the semver field to [gitmojis.json](https://github.com/carloscuesta/gitmoji/blob/master/src/data/gitmojis.json).
38-
- Generate the files `gitmojis.json` with the semver field added.
39-
- :rocket: You can easily do Semver Release automatically by just committing with gitmoji. ( [like this](https://github.com/nkmr-jp/gitmoji-semver/releases) )
40-
- Automate versioning and release with GithubActions and [semantic-release](https://github.com/semantic-release/semantic-release).
4137

38+
- :smile: generate [gitmojis.json](https://github.com/carloscuesta/gitmoji/blob/master/src/data/gitmojis.json) with semver field.
39+
- :smile: generate [semantic-release](https://github.com/semantic-release/semantic-release) setting files and release template.
40+
- :rocket: auto release by semver (semantic versioning) just by committing with gitmoji. ( [like this](https://github.com/nkmr-jp/gitmoji-semver-sample/releases) )
41+
42+
### Release template type
43+
44+
| [default](https://github.com/nkmr-jp/gitmoji-semver-sample/releases/tag/v2.4.0) | [simple](https://github.com/nkmr-jp/gitmoji-semver-sample/releases/tag/v2.3.0) |
45+
| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
46+
| ![img_2.png](img_2.png) | ![img_1.png](img_1.png) |
4247

4348
## How to use in Mac
4449

4550
### Install
51+
4652
Require `curl`, `jq`, `yq` and `node` command.
4753

4854
```sh
@@ -60,17 +66,19 @@ git clone https://github.com/nkmr-jp/gitmoji-semver
6066
```
6167

6268
### Usage
69+
6370
```sh
6471
cd ./gitmoji-semver
6572
make help
6673
```
6774

68-
<img src="https://user-images.githubusercontent.com/8490118/97778892-c4d51580-1bbd-11eb-9236-c9c676d4337d.png" width=800>
75+
<img src="img.png" width=800>
6976

7077
## How to use in GithubActions ( only 3 minutes )
7178

72-
The following steps will automate versioning and releasing with gitmoji using GithubActions.
73-
You only need to add two files, and you're ready to go. Feel free to try it out in your own Github Repository.
79+
The following steps will automate versioning and releasing with gitmoji using GithubActions. You
80+
only need to add two files, and you're ready to go. Feel free to try it out in your own Github
81+
Repository.
7482

7583
### Step 1: Add `.semver.yml` to your Repository root
7684

@@ -101,7 +109,7 @@ semver:
101109
- construction # Work in progress.
102110
```
103111
104-
### Step 2: Add `release.yml` to `.github/workflows/`
112+
### Step 2: Add `release.yml` to `.github/workflows/`
105113

106114
```yml
107115
# .github/workflows/release.yml
@@ -138,7 +146,7 @@ jobs:
138146
- name: Generate semantic-release configs
139147
working-directory: ./gitmoji-semver
140148
run: |
141-
make scaffold V=v3.0.0 F=../.semver.yml O=..
149+
make scaffold V=v3.0.0 F=../.semver.yml O=.. M=simple
142150
- name: Release
143151
working-directory: ./.release
144152
env:
@@ -149,6 +157,7 @@ jobs:
149157
```
150158

151159
### Step 3: Commit and Push
160+
152161
```sh
153162
git add .
154163
git commit -m ":construction_worker: Add Release settings by https://github.com/nkmr-jp/gitmoji-semver"
@@ -159,7 +168,7 @@ git push
159168

160169
#### If you want to run locally
161170

162-
There will not be an actual Release. You can see how it works.
171+
There will not be an actual Release. You can see how it works.
163172

164173
```sh
165174
brew install act
@@ -179,10 +188,10 @@ act -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04 # ※ 16GB docker image
179188

180189
👤 **nkmr-jp**
181190

182-
183191
## Show your support
184192

185193
Give a ⭐️ if this project helped you!
186194

187195
***
188-
_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_
196+
_This README was generated with ❤️
197+
by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_

gen-release-template.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,33 @@ function run() {
2121
}
2222

2323
for (const key of Object.keys(semverObj)) {
24-
if (key === 'ignore'){
24+
if (key === 'ignore') {
2525
continue
2626
}
2727
res += `\n{{${key}Header commits}}\n`
2828
res += `{{#with commits}}`
2929
for (const gitmojiObj of semverObj[key]) {
30-
res += buildH3Template(gitmojiObj)
30+
res += buildTemplate(gitmojiObj)
3131
}
3232
res += "{{/with}}\n"
3333
}
3434
fs.writeFileSync('./build/dist/release-template.hbs', res);
3535
}
3636

37-
function buildH3Template(gitmojiObj) {
38-
return `
39-
{{#if ${gitmojiObj.name.replace(/-/g,'_')}}}
37+
function buildTemplate(gitmojiObj) {
38+
if (process.argv[2] === "simple") {
39+
return `{{#if ${gitmojiObj.name.replace(/-/g, '_')}}} {{#each ${gitmojiObj.name.replace(/-/g, '_')}}}- {{> commitTemplate}}
40+
{{/each}}{{/if}}`
41+
} else {
42+
return `
43+
{{#if ${gitmojiObj.name.replace(/-/g, '_')}}}
4044
### ${gitmojiObj.emoji} ${gitmojiObj.description}
41-
{{#each ${gitmojiObj.name.replace(/-/g,'_')}}}
45+
{{#each ${gitmojiObj.name.replace(/-/g, '_')}}}
4246
- {{> commitTemplate}}
4347
{{/each}}
4448
{{/if}}
4549
`
50+
}
4651
}
4752

4853
run()

img.png

87.1 KB
Loading

img_1.png

174 KB
Loading

img_2.png

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

0 commit comments

Comments
 (0)