build: updates release and tooling flows

This commit is contained in:
GitHub Actions
2022-04-11 09:26:44 +02:00
parent e5ba2cf34b
commit b07cc92b5c
15 changed files with 16112 additions and 2911 deletions

13
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1,13 @@
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.
# These owners will be the default owners for everything in the repo.
* @simonecorsi
# Order is important. The last matching pattern has the most precedence.
# So if a pull request only touches javascript files, only these owners
# will be requested to review.
# *.js @octocat @github/js
# You can also use email addresses if you prefer.
# docs/* docs@example.com

18
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: 'npm' # See documentation for possible values
directory: '/' # Location of package manifests
schedule:
interval: 'daily'
open-pull-requests-limit: 10
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
open-pull-requests-limit: 10

15
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,15 @@
## 🚨 Proposed changes
> Please review the [guidelines for contributing](../../CONTRIBUTING.md) to this repository.
[[Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.]]
## ⚙️ Types of changes
What types of changes does your code introduce? _Put an `x` in the boxes that apply_
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation Update (if none of the other choices apply)
- [ ] Refactor

View File

@@ -1,19 +0,0 @@
name: Test
on: [pull_request]
jobs:
version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: tests
run: npm cit

20
.github/workflows/merge.yml vendored Normal file
View File

@@ -0,0 +1,20 @@
name: Run tests
on: [pull_request]
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [12.x, 14.x, 16.x]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm it

View File

@@ -1,47 +0,0 @@
name: Publish workflow
on:
push:
branches: main
jobs:
version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: fregante/setup-git-user@v1
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: tests
run: npm cit
- name: build
run: npm run build
- name: Bump version and push tag
id: changelog
uses: TriPSs/conventional-changelog-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
git-message: 'chore(release): {version}'
preset: ''
- name: Create github Release
uses: actions/create-release@v1
if: ${{ steps.changelog.outputs.skipped == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.changelog.outputs.tag }}
release_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.changelog }}
- name: Latest tag
uses: EndBug/latest-tag@v1.4.0

46
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,46 @@
name: Release
on: [workflow_dispatch]
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [12.x, 14.x, 16.x]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm it
release:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: npm i
- name: Build
run: npm run build
- name: Semantic release
uses: codfish/semantic-release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: '${{ github.actor }}'
GIT_COMMITTER_NAME: '${{ github.actor }}'

1
.husky/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
_

4
.husky/commit-msg Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install commitlint --edit $1

4
.husky/pre-commit Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install lint-staged

View File

@@ -1,7 +0,0 @@
module.exports = {
hooks: {
'prepare-commit-msg': 'exec < /dev/tty && git cz --hook || true',
'pre-commit': 'lint-staged',
'commit-msg': 'commitlint -E HUSKY_GIT_PARAMS',
},
};

15
.releaserc.json Normal file
View File

@@ -0,0 +1,15 @@
{
"branches": [{ "name": "main" }],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/git",
{
"assets": ["CHANGELOG.md", "package.json", "package-lock.json"]
}
],
"@semantic-release/github"
]
}

18777
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -12,7 +12,8 @@
"style:prettier": "prettier \"src/**/*.ts\" --list-different --write",
"build": "./node_modules/.bin/ncc build src/index.ts -o ./",
"dev": "ts-node-dev src/index.ts",
"prerelease": "npm run build"
"prerelease": "npm run build",
"prepare": "node prepare.js || echo 'Skipping prepare'"
},
"keywords": [
"github",
@@ -24,10 +25,15 @@
"javascript"
],
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@commitlint/cli": "^16.2.3",
"@commitlint/config-conventional": "^16.2.1",
"@octokit/rest": "^18.0.12",
"@octokit/types": "^6.2.1",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/commit-analyzer": "^9.0.2",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^8.0.4",
"@semantic-release/release-notes-generator": "^10.0.3",
"@types/ejs": "^3.0.5",
"@types/got": "^9.6.11",
"@types/node": "^14.14.5",
@@ -36,31 +42,29 @@
"@typescript-eslint/parser": "^4.6.0",
"@vercel/ncc": "^0.26.2",
"ava": "^3.8.2",
"benchmark": "^2.1.4",
"cz-conventional-changelog": "^3.2.0",
"eslint": "^7.17.0",
"eslint-config-prettier": "^7.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.3.1",
"husky": "^4.2.5",
"husky": "^6.0.0",
"lint-staged": "^10.2.2",
"markdown-toc": "^1.2.0",
"nyc": "^15.0.1",
"prettier": "^2.0.5",
"sinon": "^9.2.3",
"standard-version": "^9.0.0",
"ts-node-dev": "^1.1.1",
"typescript": "^4.1.3"
},
"dependencies": {
"@actions/exec": "^1.0.4",
"@actions/core": "^1.2.6",
"@actions/exec": "^1.0.4",
"ejs": "^3.1.5",
"got": "^11.8.1",
"remark": "^13.0.0",
"remark-toc": "^7.0.0"
},
"volta": {
"node": "14.15.4"
"node": "16.14.2",
"npm": "8.6.0"
}
}
}

13
prepare.js Normal file
View File

@@ -0,0 +1,13 @@
'use strict';
let isCi = false;
try {
isCi = require('is-ci');
} catch (_) {
isCi = true;
}
if (!isCi) {
require('husky').install();
}