generated from aifrak/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Release and update
CHANGELOG.md
with release-it
from workf…
…low (#164) - Add `release-it` with its custom calver plugin - Add `RELEASE.md` - Add `release` scope and remove `dev` scope - Add convention about Git workflow
- Loading branch information
Showing
33 changed files
with
4,870 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,6 @@ binary_next_line = true | |
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.hbs] | ||
insert_final_newline = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,9 @@ | |
node_modules/ | ||
npm_cache/ | ||
|
||
# release-it config file | ||
!.release-it.js | ||
|
||
# Elixir | ||
_build/ | ||
cover/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version-modifier: | ||
description: "Version modifier; optional (dev, alpha, beta, rc)" | ||
required: false | ||
|
||
jobs: | ||
create-release: | ||
name: Release | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Check if main branch | ||
if: ${{ github.ref != 'refs/heads/main' }} | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
core.setFailed('Error: Release is possible only on the main branch') | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup git config | ||
run: | | ||
git config user.name "${GITHUB_ACTOR}" | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
# —————————————————————————————————————————————— # | ||
# Dependencies # | ||
# —————————————————————————————————————————————— # | ||
|
||
- name: Setup NodeJS | ||
uses: actions/[email protected] | ||
with: | ||
node-version: 16 | ||
cache: npm | ||
cache-dependency-path: "**/package-lock.json" | ||
|
||
- name: Install node modules | ||
run: npm ci --quiet | ||
|
||
# —————————————————————————————————————————————— # | ||
# Application # | ||
# —————————————————————————————————————————————— # | ||
|
||
- name: Update changelog, update all versions, tag and cut a release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
RELEASE: true | ||
run: | | ||
./run release:ci ${{ github.event.inputs.version-modifier }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,6 @@ config/*.secret.exs | |
|
||
# Keep .gitkeep files | ||
!/**/.gitkeep | ||
|
||
# Generated temporary files | ||
*.tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// CalVer date tags 0Y, 0M, 0W and 0D are not supported by "@release-it/bumper" | ||
// and "@release-it/conventional-changelog". | ||
// Reason: Those plugins support semver only. | ||
|
||
const { readFileSync } = require('fs'); | ||
const commitGroupsSort = require('./scripts/release-it/plugins/conventional-changelog/commit-groups-sort'); | ||
const types = require('./scripts/release-it/types'); | ||
|
||
const scriptsPath = './scripts/release-it'; | ||
const hooksPath = `${scriptsPath}/hooks`; | ||
const pluginsPath = `${scriptsPath}/plugins`; | ||
const templatesPath = `${scriptsPath}/templates`; | ||
|
||
module.exports = { | ||
git: { | ||
// eslint-disable-next-line no-template-curly-in-string | ||
commitMessage: 'chore: Release ${version}\n\n[skip ci]', | ||
requireBranch: 'main', | ||
}, | ||
github: { | ||
release: true, | ||
}, | ||
npm: false, | ||
hooks: { | ||
'before:conventional-changelog:beforeRelease': `bash ${hooksPath}/changelog/delete_header.sh`, | ||
'after:conventional-changelog:beforeRelease': `bash ${hooksPath}/changelog/add_header.sh`, | ||
}, | ||
plugins: { | ||
'@release-it/bumper': { | ||
in: { | ||
file: 'VERSION', | ||
type: 'text/plain', | ||
}, | ||
out: [ | ||
{ | ||
file: 'VERSION', | ||
type: 'text/plain', | ||
}, | ||
], | ||
}, | ||
[`${pluginsPath}/calver-bumper.js`]: {}, | ||
'@release-it/conventional-changelog': { | ||
infile: 'CHANGELOG.md', | ||
ignoreRecommendedBump: true, | ||
preset: { | ||
name: 'conventionalcommits', | ||
types, | ||
}, | ||
writerOpts: { | ||
headerPartial: readFileSync(`${templatesPath}/header.hbs`, 'utf-8'), | ||
commitGroupsSort, | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Changelog | ||
|
||
This file will be updated automatically. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Release | ||
|
||
Releases are cut from the `main` branch only. | ||
|
||
_Versioning convention_: [Calendar Versioning (CalVer)](https://calver.org/) | ||
_Format_: `YYYY.MM.MINOR` | ||
_Possible modifiers_: | ||
|
||
- Empty | ||
- `dev` for releases as development or prealpha | ||
- `alpha` | ||
- `beta` | ||
- `rc` for releases as release candidate | ||
|
||
Examples: | ||
|
||
- Empty modifier: `2021.11.64` | ||
- `alpha` modifier: `2021.11.64-alpha` | ||
|
||
## How to publish a release? 🤔 | ||
|
||
1. Go to the repository on `github.com` | ||
1. Click on `Actions` | ||
1. Click on `Release` | ||
1. Click on `Run workflow` | ||
1. Choose a version modifier suffix (optional). Possible values: | ||
- Let it empty for stable release. No modifier will be added. | ||
- `dev` for releases as development or prealpha | ||
- `alpha` | ||
- `beta` | ||
- `rc` for releases as release candidate | ||
1. Click on `Run workflow` | ||
|
||
This workflow uses [Release It!](https://github.com/release-it/release-it) to: | ||
|
||
- update `VERSION` | ||
- generate/update `CHANGELOG.md` | ||
- commit and push to git | ||
- attach assets to `Github Release` | ||
- create a `Github Release` | ||
|
||
## How `CHANGELOG.md` is updated? 📄 | ||
|
||
`CHANGELOG.md` is automatically by the plugin | ||
[@release-it/conventional-changelog](https://github.com/release-it/conventional-changelog). | ||
|
||
Custom templates under `./scripts/release-it` control the header text of the | ||
file. The later has tag to distinguish the static header from the generated | ||
lines. | ||
|
||
## What is `VERSION`? 🤔 | ||
|
||
It contains the latest version. | ||
|
||
In other words, it is the latest git tag. The version from this file is used to calculate | ||
the next version. | ||
|
||
This file and other files containing the application version are automatically | ||
updated by [@release-it/bumper](https://github.com/release-it/bumper). | ||
The later is supported by a custom `release-it` plugin (`calver-bumper.js`) | ||
which calculate the next `CalVer`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2021.10.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.