Skip to content

Commit

Permalink
build(release)!: automate releases with semantic-release (#377)
Browse files Browse the repository at this point in the history
* Use dummy package version

* Add release job to main workflow

* Add PR workflow to check title

* Update `repository.url` package field

* Use conventionalcommits preset

* Specify packed files

* Update lib/init-resume.json and remove test/resume.json

* Remove Markdown files from .gitignore

* Use sample resume from resume-schema

* Define missing extra plugins to install

* build(release)!: automate releases with semantic-release

* Add CONTRIBUTING.md
  • Loading branch information
rbardini authored Sep 23, 2020
1 parent 3ac2ea8 commit cc8b66f
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 261 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,28 @@ jobs:

- name: Test
run: npm test

release:
needs: test
runs-on: ubuntu-latest
name: Release
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12

- name: Install
run: npm ci

- name: Run semantic-release
uses: cycjimmy/semantic-release-action@v2
with:
extra_plugins: |
conventional-changelog-conventionalcommits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
18 changes: 18 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Pull request
on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize

jobs:
lint:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Check PR title
uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
node_modules
resume.json
!README.md
*.html
*.md
*.pdf
3 changes: 3 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"preset": "conventionalcommits"
}
51 changes: 51 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Contributing

## Writing commit messages

resume-cli uses [semantic-release](https://semantic-release.gitbook.io/) to automate version management and package publishing.
semantic-release determines the next version number and [release notes](https://github.com/jsonresume/resume-cli/releases) based on the commit messages, meaning a convention must be followed.

resume-cli uses the [Conventional Commits](https://www.conventionalcommits.org/) specification to describe features, fixes, and breaking changes in commit messages. A typical commit title is structured as follows:

```txt
<type>[optional scope]: <description>
```

### Type

Must be one of the following:

- `fix:` for a bug fix (corresponds to a `PATCH` release);
- `feat:` for a new feature (corresponds to a `MINOR` release);
- other non-release types such as `build:`, `docs:`, `refactor:`, `test:` and others (see [recommended](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#type-enum)).

Appending a `!` after the type/scope indicates a _breaking change_ (corresponds to a `MAJOR` release). A breaking change can be part of commits of any type.

### Scope

A scope may be provided to a commit’s type, to provide additional contextual information and is contained within parenthesis, e.g. `feat(theme): add ability to specify theme`.

### Description

The description contains a concise explanation of the changes:

- use the imperative, present tense, e.g. _"change"_, not _"changed"_ nor _"changes"_;
- don't capitalize the first letter;
- no period (`.`) at the end.

## Submitting a pull request

The pull request title should follow the same [commit title conventions](#writing-commit-messages), as it will become the merge commit title, and thus be used to determine the type of changes in the codebase.

Because pull request commits are squashed on merge, you don't need to follow this convention on every _feature branch_ commit, but certainly do for the _merge_ commit.

## Merging a pull request

Before merging a pull request:

1. make sure the pull request branch is synced with the target branch;
2. make sure all pull request checks are passing;
3. merge using the _squash and merge_ option;
4. assuming the pull request title is following the [title conventions](#submitting-a-pull-request):
1. do not modify the merge commit title field, keeping the pull request ID reference;
2. empty the merge commit message field, only adding content if relevant (e.g. breaking changes).
114 changes: 0 additions & 114 deletions lib/init-resume.json

This file was deleted.

2 changes: 1 addition & 1 deletion lib/init.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('fs');
const read = require('read');
const resumeJson = require('./init-resume.json');
const resumeJson = require('resume-schema/sample.resume.json');
const chalk = require('chalk'); // slowly replace colors with chalk

const fillInit = () => {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"name": "resume-cli",
"version": "1.2.8",
"version": "0.0.0-development",
"description": "The JSON Resume command line interface",
"main": "index.js",
"engines": {
"node": ">=10.18.1"
},
"files": [
"index.js",
"lib/*"
],
"scripts": {
"format": "prettier --write .",
"format:check": "prettier --check .",
Expand All @@ -14,7 +18,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/rolandnsharp/resume-cli.git"
"url": "https://github.com/jsonresume/resume-cli.git"
},
"license": "MIT",
"bin": {
Expand Down
Loading

0 comments on commit cc8b66f

Please sign in to comment.