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: add release process scripts #20

Merged
merged 5 commits into from
Dec 14, 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
11 changes: 11 additions & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is automatically added by @npmcli/template-oss. Do not edit.

module.exports = {
extends: ['@commitlint/config-conventional'],
// If you change rules be sure to also update release-please.yml
rules: {
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'chore', 'deps']],
'header-max-length': [2, 'always', 80],
'subject-case': [2, 'always', ['lower-case', 'sentence-case', 'start-case']],
},
}
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is automatically added by @npmcli/template-oss. Do not edit.

version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
allow:
- dependency-type: direct
versioning-strategy: increase-if-necessary
commit-message:
prefix: deps
prefix-development: chore
labels:
- "dependencies"
23 changes: 23 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file is automatically added by @npmcli/template-oss. Do not edit.

name: Audit

on:
schedule:
# "At 01:00 on Monday" https://crontab.guru/#0_1_*_*_1
- cron: "0 1 * * 1"
workflow_dispatch:

jobs:
audit:
name: npm audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install deps
run: npm i --package-lock
- name: Audit
run: npm audit
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
branches:
- main
- latest
schedule:
# "At 02:00 on Monday" https://crontab.guru/#0_1_*_*_1
- cron: "0 2 * * 1"

jobs:
lint:
Expand All @@ -17,9 +20,8 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: '16'
cache: npm
- run: npm i --prefer-online -g npm@latest
- run: npm ci
- run: npm i
- run: npm run lint

test:
Expand Down Expand Up @@ -47,7 +49,6 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm i --prefer-online -g npm@latest
- run: npm ci
- run: npm i
- run: npm test --ignore-scripts
27 changes: 27 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file is automatically added by @npmcli/template-oss. Do not edit.

name: Pull Request Linting

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

jobs:
check:
name: Check PR Title or Commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
lukekarrys marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install deps
run: |
npm i -D @commitlint/cli @commitlint/config-conventional
- name: Check commits OR PR title
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
npx commitlint -x @commitlint/config-conventional -V --from origin/main --to ${{ github.event.pull_request.head.sha }} || echo $PR_TITLE | npx commitlint -x @commitlint/config-conventional -V
25 changes: 25 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file is automatically added by @npmcli/template-oss. Do not edit.

name: Release Please

on:
push:
branches:
- main

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v2
id: release
with:
package-name: conventional-test
release-type: node
# If you change changelog-types be sure to also update commitlintrc.js
changelog-types: >
[{"type":"feat","section":"Features","hidden":false},
{"type":"fix","section":"Bug Fixes","hidden":false},
{"type":"docs","section":"Documentation","hidden":false},
{"type":"deps","section":"dependencies","hidden":false},
{"type":"chore","hidden":true}]
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
/*

# keep these
!/.commitlintrc.js
!/.npmrc
!/.eslintrc*
!/.github
!**/.gitignore
!/package.json
!/package-lock.json
!/docs
!/bin
!/lib
Expand Down
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
;This file is automatically added by @npmcli/template-oss. Do not edit.

package-lock=false
lukekarrys marked this conversation as resolved.
Show resolved Hide resolved
23 changes: 23 additions & 0 deletions lib/content/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file is automatically added by @npmcli/template-oss. Do not edit.

name: Audit

on:
schedule:
# "At 01:00 on Monday" https://crontab.guru/#0_1_*_*_1
- cron: "0 1 * * 1"
workflow_dispatch:

jobs:
audit:
name: npm audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install deps
run: npm i --package-lock
- name: Audit
run: npm audit
9 changes: 5 additions & 4 deletions lib/content/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
branches:
- main
- latest
schedule:
# "At 02:00 on Monday" https://crontab.guru/#0_1_*_*_1
- cron: "0 2 * * 1"

jobs:
lint:
Expand All @@ -17,9 +20,8 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: '16'
cache: npm
- run: npm i --prefer-online -g npm@latest
- run: npm ci
- run: npm i
- run: npm run lint

test:
Expand Down Expand Up @@ -47,7 +49,6 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm i --prefer-online -g npm@latest
- run: npm ci
- run: npm i
- run: npm test --ignore-scripts
11 changes: 11 additions & 0 deletions lib/content/commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is automatically added by @npmcli/template-oss. Do not edit.
lukekarrys marked this conversation as resolved.
Show resolved Hide resolved

module.exports = {
extends: ['@commitlint/config-conventional'],
// If you change rules be sure to also update release-please.yml
rules: {
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'chore', 'deps']],
'header-max-length': [2, 'always', 80],
'subject-case': [2, 'always', ['lower-case', 'sentence-case', 'start-case']],
},
}
16 changes: 16 additions & 0 deletions lib/content/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is automatically added by @npmcli/template-oss. Do not edit.

version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
allow:
- dependency-type: direct
versioning-strategy: increase-if-necessary
commit-message:
prefix: deps
prefix-development: chore
labels:
- "dependencies"
3 changes: 2 additions & 1 deletion lib/content/gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
/*

# keep these
!/.commitlintrc.js
!/.npmrc
!/.eslintrc*
!/.github
!**/.gitignore
!/package.json
!/package-lock.json
!/docs
!/bin
!/lib
Expand Down
3 changes: 3 additions & 0 deletions lib/content/npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
;This file is automatically added by @npmcli/template-oss. Do not edit.

package-lock=false
27 changes: 27 additions & 0 deletions lib/content/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file is automatically added by @npmcli/template-oss. Do not edit.

name: Pull Request Linting

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

jobs:
check:
name: Check PR Title or Commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install deps
run: |
npm i -D @commitlint/cli @commitlint/config-conventional
- name: Check commits OR PR title
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
npx commitlint -x @commitlint/config-conventional -V --from origin/main --to ${{ github.event.pull_request.head.sha }} || echo $PR_TITLE | npx commitlint -x @commitlint/config-conventional -V
25 changes: 25 additions & 0 deletions lib/content/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file is automatically added by @npmcli/template-oss. Do not edit.

name: Release Please

on:
push:
branches:
- main

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v2
id: release
with:
package-name: conventional-test
release-type: node
# If you change changelog-types be sure to also update commitlintrc.js
changelog-types: >
[{"type":"feat","section":"Features","hidden":false},
{"type":"fix","section":"Bug Fixes","hidden":false},
{"type":"docs","section":"Documentation","hidden":false},
{"type":"deps","section":"dependencies","hidden":false},
{"type":"chore","hidden":true}]
6 changes: 6 additions & 0 deletions lib/postinstall/copy-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@ const contentDir = resolve(__dirname, '..', 'content')
const moduleFiles = {
'.eslintrc.js': './eslintrc.js',
'.gitignore': './gitignore',
'.npmrc': './npmrc',
'SECURITY.md': './SECURITY.md',
}

const repoFiles = {
'.commitlintrc.js': './commitlintrc.js',
'.github/workflows/ci.yml': './ci.yml',
'.github/ISSUE_TEMPLATE/bug.yml': './bug.yml',
'.github/ISSUE_TEMPLATE/config.yml': './config.yml',
'.github/CODEOWNERS': './CODEOWNERS',
'.github/dependabot.yml': './dependabot.yml',
'.github/workflows/audit.yml': './audit.yml',
'.github/workflows/pull-request.yml': './pull-request.yml',
'.github/workflows/release-please.yml': './release-please.yml',
}

// currently no workspace moduleFiles
Expand Down
Loading