Skip to content

Commit

Permalink
feat(ci): add release automation (#45)
Browse files Browse the repository at this point in the history
feat(ci): add release automation (#45)
  • Loading branch information
victorgz authored Apr 12, 2021
1 parent ec7845f commit bd193ad
Show file tree
Hide file tree
Showing 9 changed files with 4,260 additions and 16,450 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/main.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# This is a basic workflow to help you get started with Actions

# Main CI workflow for new PRs
name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
pull_request:
branches: [master]

jobs:
formatting-and-linting:
code-formatting-and-linting:
runs-on: ubuntu-latest
steps:
# Checkout the code in the pull request
Expand Down Expand Up @@ -49,6 +46,7 @@ jobs:

scratch-org-test:
runs-on: ubuntu-latest
needs: code-formatting-and-linting
steps:
# Install Salesforce CLI
- name: Install Salesforce CLI
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# PR Linting workflow
name: PR-lint

on:
pull_request:
types: [edited, opened, reopened, synchronize]

jobs:
commit-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v2

pr-lint:
runs-on: ubuntu-latest
steps:
- uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,7 @@ TestCache.xml
TestsResultsCache.xml

tests/
_site/
_site/

# direnv
.envrc
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint --edit
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
30 changes: 30 additions & 0 deletions MAINTAINING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Maintaining

## Release Process

The release process is composed by multiple standards and utilities combined together:

- [Conventional Commits](https://conventionalcommits.org/) based on the [Angular convention](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines) are used to keep standard commit messages all around the project
- [Semantic Versioning (SemVer) Specification](https://semver.org/) is used to determine the version format of each new release
- [conventional-changelog/standard-version](https://github.com/conventional-changelog/standard-version) automatizes the process of creating a new release based on the commit history
- [conventional-github-releaser/conventional-github-releaser](https://github.com/conventional-changelog/releaser-tools/tree/master/packages/conventional-github-releaser) takes care of publishing the new release on GitHub

### Pre-requisites

1. Create a new [GitHub Personal Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
2. Set the `CONVENTIONAL_GITHUB_RELEASER_TOKEN` environment variable with the github personal token value (you can use [direnv](https://direnv.net/))

### Releasing a new version

```sh
$ npm run release
```

This command will:

- Create a new version based on the commit types from `HEAD` and `package.json` version
- Create the changelog with all the commits from `HEAD` and the last tag version following [keepachangelog](https://keepachangelog.com/en/1.0.0/)
- Create a new commit to update the following files: `CHANGELOG.md`, `package.json` and `package-lock.json`
- Create a new tag following the SemVer Standard
- Push this tag to the remote
- Trigger the new version publication
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-angular'] };
Loading

0 comments on commit bd193ad

Please sign in to comment.