diff --git a/.github/workflows b/.github/workflows deleted file mode 160000 index 0fd09eb..0000000 --- a/.github/workflows +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0fd09eb0ecb1d6b3ab1830a0b61188d8a10fdb4a diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 0000000..9f4413f --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,15 @@ +name: commitlint +on: pull_request + +jobs: + commitlint: + name: Lint Commit Messages + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - run: | + yarn global add @commitlint/cli @commitlint/config-conventional + echo "$(yarn global bin)" >> $GITHUB_PATH + - run: make lint diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..523a255 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,26 @@ +name: release-please +on: + push: + branches: + - master +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: GoogleCloudPlatform/release-please-action@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + release-type: node + - uses: actions/checkout@v2 + if: ${{ steps.release.outputs.release_created }} + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: "https://registry.npmjs.org" + if: ${{ steps.release.outputs.release_created }} + - run: npm ci + if: ${{ steps.release.outputs.release_created }} + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + if: ${{ steps.release.outputs.release_created }} diff --git a/Makefile b/Makefile index c2636af..f34ed99 100644 --- a/Makefile +++ b/Makefile @@ -3,4 +3,4 @@ GITHUB_BASE_REF ?= master .PHONY: lint lint: - commitlint -g index.js --from=$$(git rev-parse remotes/origin/$(GITHUB_BASE_REF)) + commitlint -g commitlint.config.js --from=$$(git rev-parse remotes/origin/$(GITHUB_BASE_REF)) diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..5bd3362 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,8 @@ +module.exports = { + extends: ["./index.js"], + parserPreset: { + parserOpts: { + issuePrefixes: ["FBTLOPS-"], + }, + }, +}; diff --git a/index.js b/index.js index a2da839..22d1b22 100644 --- a/index.js +++ b/index.js @@ -1,36 +1,36 @@ module.exports = { - extends: ['@commitlint/config-conventional'], - rules: { - 'body-case': [2, 'always', 'sentence-case'], - 'body-leading-blank': [2, 'always'], - 'body-max-line-length': [2, 'always', 72], - 'footer-leading-blank': [2, 'always'], - 'footer-max-line-length': [2, 'always', 72], - 'header-max-length': [2, 'always', 72], - 'header-min-length': [2, 'always', 30], - 'references-empty': [2, 'never'], - 'scope-case': [2, 'always', 'lower-case'], - 'subject-case': [2, 'always', 'sentence-case'], - 'subject-empty': [2, 'never'], - 'subject-full-stop': [2, 'never', '.'], - 'type-case': [2, 'always', 'lower-case'], - 'type-empty': [2, 'never'], - 'type-enum': [ - 2, - 'always', - [ - 'build', - 'chore', - 'ci', - 'docs', - 'feat', - 'fix', - 'perf', - 'refactor', - 'revert', - 'style', - 'test', - ], - ], - }, + extends: ["@commitlint/config-conventional"], + rules: { + "body-case": [2, "always", "sentence-case"], + "body-leading-blank": [2, "always"], + "body-max-line-length": [2, "always", 72], + "footer-leading-blank": [2, "always"], + "footer-max-line-length": [2, "always", 72], + "header-max-length": [2, "always", 72], + "header-min-length": [2, "always", 30], + "references-empty": [2, "never"], + "scope-case": [2, "always", "lower-case"], + "subject-case": [2, "always", "sentence-case"], + "subject-empty": [2, "never"], + "subject-full-stop": [2, "never", "."], + "type-case": [2, "always", "lower-case"], + "type-empty": [2, "never"], + "type-enum": [ + 2, + "always", + [ + "build", + "chore", + "ci", + "docs", + "feat", + "fix", + "perf", + "refactor", + "revert", + "style", + "test", + ], + ], + }, };