Skip to content

Commit

Permalink
feat: semantic-release (bradennapier#22)
Browse files Browse the repository at this point in the history
* feat: batched annotations

* take first 50 annotations from file to respect [Github Check annotation limit](https://developer.github.com/v3/checks/runs/#output-object-1)

* fix: handle batched annotations

* feat: run batched annotations in parallel

Co-authored-by: Braden Napier <brady.napier@dashos.net>

* build: add semantic release action

* build: various build and release changes

Co-authored-by: Stephen Chung <spchung95@gmail.com>
  • Loading branch information
bradennapier and imsteev authored Jul 14, 2020
1 parent e1e4b7e commit d69fe57
Show file tree
Hide file tree
Showing 12 changed files with 3,571 additions and 150 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ dist/
lib/
node_modules/
!.prettierrc.js
!.eslintrc.js
!.eslintrc.js
10 changes: 4 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.eslint.json',
},
plugins: ['@typescript-eslint', 'prettier'],
extends: [
'eslint:recommended',
Expand All @@ -9,18 +12,13 @@ module.exports = {
'plugin:prettier/recommended',
],
rules: {
'prettier/prettier': ['error'],
'prettier/prettier': 'error',
// octokit/rest requires parameters that are not in camelcase
camelcase: 'off',
// '@typescript-eslint/camelcase': ['error', {properties: 'never'}],
},
env: {
node: true,
jest: true,
es6: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
};
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release
on:
push:
branches:
- master
- next
- beta
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2-beta
with:
node-version: '12'
check-latest: true
- name: Install dependencies
run: yarn
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
dist/
lib/
node_modules/
1 change: 0 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ module.exports = {
useTabs: false,
singleQuote: true,
trailingComma: 'all',
parser: 'typescript',
};
20 changes: 13 additions & 7 deletions README.md → docs/README.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.1.0
- uses: bradennapier/eslint-plus-action@__VERSION__
```
## Features
Expand Down Expand Up @@ -97,11 +97,17 @@ GitHub Actions only have read permissions when a forked PR is opened. However,

Each time the schedule job runs it will run through any new artifacts and update the PR with the results like normal. *If a job hasn't been detected in the last 24 hours then the action will no longer save artifacts.* This is so you do not needlessly use up your data storage.

> Note that we delete the artifacts as soon as they have been processed so they will not use up your storage for very long.
> Note that we delete the artifacts as soon as they have been processed so they will
> not use up your storage for very long.

> You can optionally add additional optimization by also making sure to run this action
> on the `[closed]` event so that we can cleanup all the artifacts when this occurs.

> You can optionally add additional optimization by also making sure to run this action on the `[closed]` event so that we can cleanup all the artifacts when this occurs.
<br />

> The scheduler will not start running until you have pushed the workflow to your main branch (`master`). If it still does not run you can try pushing an empty commit, it seems that is sometimes required `git commit --allow-empty -m 'redeploy schedule action'`
> The scheduler will not start running until you have pushed the workflow to your main
> branch (`master`). If it still does not run you can try pushing an empty commit, it
> seems that is sometimes required `git commit --allow-empty -m 'redeploy schedule action'`

```yml
name: "lint"
Expand All @@ -122,7 +128,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.1.0
- uses: bradennapier/eslint-plus-action@__VERSION__
```

## Examples
Expand All @@ -140,7 +146,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.1.0
- uses: bradennapier/eslint-plus-action@__VERSION__
```

### Environment Variables
Expand All @@ -153,7 +159,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.1.0
- uses: bradennapier/eslint-plus-action@__VERSION__
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
```
Expand Down
23 changes: 14 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"description": "TypeScript template action",
"main": "lib/run.js",
"sideEffects": false,
"scripts": {
"build": "tsc",
"format": "prettier --write **/*.ts",
Expand All @@ -16,7 +17,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/actions/typescript-action.git"
"url": "git+https://github.com/bradennapier/eslint-plus-action.git"
},
"keywords": [
"actions",
Expand All @@ -36,7 +37,7 @@
"@actions/github": "^4.0.0",
"@actions/glob": "^0.1.0",
"@octokit/plugin-throttling": "^3.3.0",
"@octokit/webhooks": "^7.6.4",
"@octokit/webhooks": "^7.6.5",
"adm-zip": "^0.4.16",
"dayjs": "^1.8.29",
"dedent": "^0.7.0",
Expand All @@ -47,27 +48,31 @@
"tslib": "^2.0.0"
},
"devDependencies": {
"@google/semantic-release-replace-plugin": "^1.0.0",
"@octokit/rest": "^18.0.0",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@types/adm-zip": "^0.4.33",
"@types/dedent": "^0.7.0",
"@types/eslint": "^7.2.0",
"@types/jest": "^26.0.4",
"@types/lodash.clonedeep": "^4.5.6",
"@types/micromatch": "^4.0.1",
"@types/node": "^14.0.18",
"@typescript-eslint/eslint-plugin": "^3.6.0",
"@typescript-eslint/parser": "^3.6.0",
"@types/node": "^14.0.23",
"@typescript-eslint/eslint-plugin": "^3.6.1",
"@typescript-eslint/parser": "^3.6.1",
"@zeit/ncc": "^0.22.3",
"eslint": "^7.4.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jest": "^23.13.2",
"eslint-plugin-jest": "^23.18.0",
"eslint-plugin-prettier": "^3.1.4",
"husky": "^4.2.5",
"jest": "^26.0.1",
"jest-circus": "^26.0.1",
"jest": "^26.1.0",
"jest-circus": "^26.1.0",
"js-yaml": "^3.14.0",
"prettier": "^2.0.5",
"ts-jest": "^26.1.1",
"semantic-release": "^17.1.1",
"ts-jest": "^26.1.2",
"ts-node": "^8.10.2",
"typescript": "^3.9.6"
}
Expand Down
28 changes: 28 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = {
plugins: [
'@semantic-release/changelog',
[
'@google/semantic-release-replace-plugin',
{
replacements: [
{
files: ['README.md'],
from: '@__VERSION__',
// eslint-disable-next-line no-template-curly-in-string
to: '@${nextRelease.gitTag}',
results: [
{
file: 'README.md',
hasChanged: true,
// numMatches: 1,
// numReplacements: 1,
},
],
countMatches: true,
},
],
},
],
['@semantic-release/git', { assets: ['README.md'] }],
],
};
3 changes: 2 additions & 1 deletion scripts/precommit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
echo "Build Typescript Files For Commit"
yarn build

git add lib/**
git add lib/**
cp -f docs/README.template.md ./README.md
14 changes: 14 additions & 0 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "./tsconfig.json",
"include": [
".json",
".eslintrc.js",
".prettierrc.js",
"release.config.js",
".stylelintrc.js",
"**/.eslintrc.js",
"**/*",
"tests/**/*.ts",
"tests/quick.ts"
]
}
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"compilerOptions": {
"target": "es2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"target": "es2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"outDir": "./lib", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"importHelpers": true,
"removeComments": true,
"pretty": true
Expand Down
Loading

0 comments on commit d69fe57

Please sign in to comment.