|
13 | 13 | </p>
|
14 | 14 |
|
15 | 15 |
|
16 |
| -> A script to add the semver field to gitmojis.json, and generate semantic-release setting files. |
| 16 | +> You can do easily Semver Release automatically by just committing with gitmoji. ( [like this](https://github.com/nkmr-jp/gitmoji-semver/releases) ) |
| 17 | + |
| 18 | +- A simple script to add the semver field to [gitmojis.json](https://github.com/carloscuesta/gitmoji/blob/master/src/data/gitmojis.json). |
| 19 | + - Generate the files `gitmojis.json` with the semver field added. |
| 20 | + - I referred to this issue. ( [Add a "semver" field for each emoji #429](https://github.com/carloscuesta/gitmoji/issues/429) ) |
| 21 | +- Automate versioning and release with GithubActions and [semantic-release](https://github.com/semantic-release/semantic-release). |
17 | 22 |
|
| 23 | +## Run in Github Actions |
18 | 24 |
|
19 |
| -- A simple script to add the semver field to [gitmojis.json](https://github.com/carloscuesta/gitmoji/blob/master/src/data/gitmojis.json). |
20 |
| -- Generate the files `gitmojis.json` with the semver field added. |
21 |
| -- You can easily change the configuration of semver in [./semver.yml](./semver.yml) . |
22 |
| -- You can easily set up [semantic-release](https://github.com/semantic-release/semantic-release) and GithubActions to your project. |
23 |
| - - It can do Semver Release automatically by just committing with gitmoji. ( [like this](https://github.com/nkmr-jp/gitmoji-semver/releases) ) |
| 25 | +The following steps will automate versioning and releasing with gitmoji using GithubActions. |
| 26 | +You only need to add two files, and you're ready to go. Feel free to try it out in your own Github repository. (**Estimated time: 3 minutes**) |
| 27 | + |
| 28 | +### Step 1: Create `.semver.yml` to your Repository root |
| 29 | + |
| 30 | +example: [./.semver.yml](.semver.yml) |
| 31 | + |
| 32 | +```yml |
| 33 | +# .semver.yml |
| 34 | + |
| 35 | +# Release Branches |
| 36 | +branches: [ master, main ] |
| 37 | + |
| 38 | +# gitmoji semver settings (default is none) |
| 39 | +semver: |
| 40 | + major: |
| 41 | + - boom # Introduce breaking changes. |
| 42 | + minor: |
| 43 | + - sparkles # Introduce new features. |
| 44 | + patch: |
| 45 | + - bug # Fix a bug. |
| 46 | + - ambulance # Critical hotfix. |
| 47 | + - green_heart # Fix CI Build. |
| 48 | + none: |
| 49 | + - memo # Add or update documentation. |
| 50 | + |
| 51 | + # Prevents it from appearing in Github's Release. |
| 52 | + ignore: |
| 53 | + - construction # Work in progress. |
| 54 | +``` |
| 55 | +
|
| 56 | +### Step 2: Create `release.yml` to `.github/workflows/` |
| 57 | + |
| 58 | +```yml |
| 59 | +# .github/workflows/release.yml |
| 60 | +
|
| 61 | +name: Release |
| 62 | +on: |
| 63 | + push: |
| 64 | + branches: |
| 65 | + - master |
| 66 | + - main |
| 67 | +jobs: |
| 68 | + release: |
| 69 | + name: Release |
| 70 | + runs-on: ubuntu-18.04 |
| 71 | + steps: |
| 72 | + - name: Checkout |
| 73 | + uses: actions/checkout@v2 |
| 74 | + with: |
| 75 | + fetch-depth: 0 |
| 76 | + - name: Setup Node.js |
| 77 | + uses: actions/setup-node@v1 |
| 78 | + with: |
| 79 | + node-version: 12 |
| 80 | + - name: Install jq yq |
| 81 | + run: | |
| 82 | + sudo wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -O /usr/bin/jq &&\ |
| 83 | + sudo chmod +x /usr/bin/jq |
| 84 | + sudo pip install yq |
| 85 | + jq --version |
| 86 | + yq --version |
| 87 | + - name: Install gitmoji-semver |
| 88 | + run: | |
| 89 | + git clone https://github.com/nkmr-jp/gitmoji-semver -b v1.4.0 |
| 90 | + - name: Generate semantic-release configs |
| 91 | + working-directory: ./gitmoji-semver |
| 92 | + run: | |
| 93 | + make scaffold V=v3.0.0 F=../.semver.yml O=.. |
| 94 | + - name: Release |
| 95 | + working-directory: ./.release |
| 96 | + env: |
| 97 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 98 | + run: | |
| 99 | + npm install |
| 100 | + npx semantic-release |
| 101 | +``` |
| 102 | + |
| 103 | +### Step 3: Commit and Push |
| 104 | +```sh |
| 105 | +git add . |
| 106 | +git commit -m ":construction_worker: Add Release settings by https://github.com/nkmr-jp/gitmoji-semver" |
| 107 | +git push |
| 108 | +``` |
| 109 | + |
| 110 | +Check out the release in your Github Repository. |
| 111 | + |
| 112 | +### If you want to run locally |
24 | 113 |
|
| 114 | +There will not be an actual Release.You can see how it works. |
25 | 115 |
|
26 |
| -## Prepare |
| 116 | +```sh |
| 117 | +brew install act |
| 118 | +act -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04 # ※ 16GB docker image |
| 119 | +``` |
| 120 | + |
| 121 | +## Run in Mac |
| 122 | + |
| 123 | +### Install |
27 | 124 | require `curl`, `jq`, `yq` and `node` command.
|
28 | 125 |
|
29 | 126 | ```sh
|
30 |
| -# Install |
31 | 127 | brew install curl yq jq
|
32 | 128 |
|
33 | 129 | yq --version
|
34 | 130 | # yq 2.10.1
|
35 | 131 | jq --version
|
36 | 132 | # jq-1.6
|
37 |
| - |
38 | 133 | node --version
|
39 |
| -# v13.14.0 # Probably works in other versions too. |
40 |
| -``` |
| 134 | +# v13.14.0 # Probably works in other versions too. |
41 | 135 |
|
42 |
| -## Install |
43 |
| - |
44 |
| -```sh |
45 |
| -git clone https://github.com/nkmr-jp/gitmoji-semver |
| 136 | +# Install |
| 137 | +git clone https://github.com/nkmr-jp/gitmoji-semver |
46 | 138 | ```
|
47 | 139 |
|
48 |
| -## Usage |
| 140 | +### Usage |
49 | 141 | ```sh
|
50 | 142 | cd ./gitmoji-semver
|
51 | 143 | make help
|
52 |
| -``` |
53 |
| - |
54 |
| - |
55 |
| -### Edit semver.yml for your project |
56 | 144 |
|
57 |
| -[./semver.yml](./semver.yml) |
58 |
| - |
59 |
| -```yml |
60 |
| -semver: |
61 |
| - major: [ boom ] |
62 |
| - minor: [ sparkles ] |
63 |
| - patch: [ bug, ambulance ] |
| 145 | +# Usage: |
| 146 | +# make COMMAND [Options] |
| 147 | +# |
| 148 | +# Commands: |
| 149 | +# gen Generate gitmojis.json with semver field (alias: g) |
| 150 | +# list Show generated gitmojis.json (alias: l) |
| 151 | +# scaffold Generate semantic-release setting files (alias: s) |
| 152 | +# |
| 153 | +# Options: |
| 154 | +# V=<version> Specify the base gitmoji version |
| 155 | +# F=<filepath> Specify semver.yml file path |
| 156 | +# O=<output dir> Specify semantic-release setting files output directory |
| 157 | +# |
| 158 | +# Examples: |
| 159 | +# make gen V=v3.0.0 F=./semver.yml |
| 160 | +# make list |
| 161 | +# make scaffold V=v3.0.0 F=./.semver.yml O=./.playground |
64 | 162 | ```
|
65 | 163 |
|
66 |
| -
|
67 | 164 | ## Reference
|
68 |
| -- https://github.com/carloscuesta/gitmoji/issues/429 |
| 165 | + |
| 166 | +If you want to customize, please refer to the following document. |
| 167 | + |
| 168 | +- [GitHub - semantic-release/semantic-release](https://github.com/semantic-release/semantic-release) |
| 169 | +- [GitHub - momocow/semantic-release-gitmoji](https://github.com/momocow/semantic-release-gitmoji) |
| 170 | +- [gitmoji | An emoji guide for your commit messages](https://gitmoji.carloscuesta.me/) |
| 171 | +- [Semantic Versioning 2.0.0 | Semantic Versioning](https://semver.org/) |
| 172 | +- [Introduction to SemVer](https://blog.greenkeeper.io/introduction-to-semver-d272990c44f2) |
| 173 | +- [Add a "semver" field for each emoji #429](https://github.com/carloscuesta/gitmoji/issues/429) |
69 | 174 |
|
70 | 175 | ## Author
|
71 | 176 |
|
|
0 commit comments