Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): add automated release #116

Merged
merged 3 commits into from
Apr 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,18 @@ jobs:
- name: 'Code Climate coverage publishing'
run: ./cc-test-reporter after-build -t lcov -r ${{ secrets.CC_TEST_REPORTER_ID }}
continue-on-error: true

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

prlint:
runs-on: ubuntu-latest
steps:
- uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.envrc
*-debug.log
*-error.log
/.nyc_output
Expand Down
28 changes: 13 additions & 15 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@

Here are the steps to publish a version

## Update local repository with the latest version of the master branch
## Prerequisites

```sh
$ git fetch -pPt --all
$ git checkout master
$ git pull origin master
```
1. Create a [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/))

## Create the new version

_This will create a new tag and new draft release on github_
## Create a new Release

```sh
$ yarn version --major|--minor|--patch --message '<Release Title>'
$ git push -f origin master --tags
$ yarn release
```

Go to gihub and finish the new release
Fill the name (select the tag created by `yarn version` <vX.X.X>)
Fill the title with the tag message value (<Release Title>)
Fill the release body following [keep a changelog](https://keepachangelog.com/en/1.0.0/) best practices
It will :

- Create a new version based on the commit types from head and package.json version
- Create the changelog with all the commit from head and the last tag version following [keepachangelog](https://keepachangelog.com/en/1.0.0/)
- Create a new commit with the generated changelog, update package.json
- Create a new tag following the semver
- Push this tag to the remote
- Trigger the new version publish
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'] }
24 changes: 17 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "lint-staged && yarn analysis",
"pre-push": "yarn test:coverage"
}
Expand Down Expand Up @@ -64,25 +65,33 @@
},
"homepage": "https://github.com/scolladon/sfdx-git-delta#readme",
"scripts": {
"analysis": "codeclimate analyze",
"commit": "commit",
"lint": "eslint . ; tslint --project . --config tslint.json --format stylish",
"lint:fix": "eslint --fix . ; tslint --fix --project . --config tslint.json --format stylish",
"test": "jest --runInBand",
"test:debug": "node --inspect node_modules/.bin/jest --runInBand",
"test:coverage": "jest --coverage --runInBand",
"test:clear:cache": "jest --clearCache",
"lint:fix": "eslint --fix . ; tslint --fix --project . --config tslint.json --format stylish",
"lint": "eslint . ; tslint --project . --config tslint.json --format stylish",
"analysis": "codeclimate analyze",
"test:coverage": "jest --coverage --runInBand",
"test:debug": "node --inspect node_modules/.bin/jest --runInBand",
"postpack": "rm -f oclif.manifest.json",
"postrelease": "npm run release:tags && npm run release:github",
"prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
"version": "oclif-dev readme && git add README.md"
"release": "standard-version",
"release:github": "conventional-github-releaser -p angular",
"release:tags": "git push --follow-tags origin master"
},
"devDependencies": {
"@commitlint/cli": "^12.0.1",
"@commitlint/config-angular": "^12.0.1",
"@commitlint/prompt-cli": "^12.0.1",
"@oclif/dev-cli": "^1",
"@oclif/plugin-help": "^2",
"@oclif/test": "^1",
"@salesforce/dev-config": "1.4.1",
"@types/chai": "^4",
"@types/mocha": "^5",
"@types/node": "^10",
"conventional-github-releaser": "^3.1.5",
"eslint": "^7.10.0",
"eslint-config-prettier": "^6.12.0",
"eslint-plugin-prettier": "^3.1.4",
Expand All @@ -93,6 +102,7 @@
"nyc": "^14",
"prettier": "^2.1.2",
"prettier-eslint": "^11.0.0",
"standard-version": "^9.1.1",
"ts-node": "^8",
"typescript": "^4.0.5"
},
Expand All @@ -106,4 +116,4 @@
"publishConfig": {
"access": "public"
}
}
}
Loading