Skip to content

Commit

Permalink
chore(template): update template to match ahmadnassri/template-node-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Nassri committed Feb 28, 2021
1 parent 9a3a486 commit 34105cb
Show file tree
Hide file tree
Showing 23 changed files with 716 additions and 256 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# ----------------------------------------------------------- #
# Note: this file originates in ahmadnassri/template-template #
# ----------------------------------------------------------- #

root = true

[*]
Expand All @@ -10,3 +14,6 @@ trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
15 changes: 15 additions & 0 deletions .github/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ----------------------------------------------------------- #
# Note: this file originates in ahmadnassri/template-template #
# ----------------------------------------------------------- #

- match:
dependency_type: development
update_type: semver:minor

- match:
dependency_type: production
update_type: security:minor

- match:
dependency_type: production
update_type: semver:patch
31 changes: 31 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,45 @@
# ----------------------------------------------------------- #
# Note: this file originates in ahmadnassri/template-template #
# ----------------------------------------------------------- #

version: 2
updates:
- package-ecosystem: gitsubmodule
open-pull-requests-limit: 10
directory: /
commit-message:
prefix: build
prefix-development: chore
include: scope
schedule:
interval: daily

- package-ecosystem: github-actions
open-pull-requests-limit: 10
directory: /
commit-message:
prefix: chore
prefix-development: chore
include: scope
schedule:
interval: daily

- package-ecosystem: npm
open-pull-requests-limit: 10
directory: /
commit-message:
prefix: build
prefix-development: chore
include: scope
schedule:
interval: daily

- package-ecosystem: docker
open-pull-requests-limit: 10
directory: /
commit-message:
prefix: build
prefix-development: chore
include: scope
schedule:
interval: daily
8 changes: 8 additions & 0 deletions .github/linters/.commit-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# ----------------------------------------------------------- #
# Note: this file originates in ahmadnassri/template-template #
# ----------------------------------------------------------- #

extends:
- "@commitlint/config-conventional"
rules:
body-max-line-length: [2, 'always', 200]
8 changes: 6 additions & 2 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# ----------------------------------------------------------- #
# Note: this file originates in ahmadnassri/template-template #
# ----------------------------------------------------------- #

# Heading levels should only increment by one level at a time
MD001: false

Expand Down Expand Up @@ -101,7 +105,7 @@ MD032: true

# inline HTML
MD033:
allowed_elements: []
allowed_elements: [details, summary]

# Bare URL used
MD034: true
Expand All @@ -127,7 +131,7 @@ MD039: true
MD040: true

# First line in file should be a top level heading
MD041: true
MD041: false

# No empty links
MD042: true
Expand Down
4 changes: 4 additions & 0 deletions .github/matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"os": ["ubuntu-latest", "windows-latest", "macos-latest"],
"node-version": [12, 14, 15]
}
14 changes: 10 additions & 4 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# ----------------------------------------------------------- #
# Note: this file originates in ahmadnassri/template-template #
# ----------------------------------------------------------- #

name: auto-merge

on:
pull_request:
on: pull_request

jobs:
auto-merge:
timeout-minutes: 5

runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'

steps:
- uses: ahmadnassri/[email protected]
- uses: actions/checkout@v2
- uses: ahmadnassri/action-dependabot-auto-merge@v2
with:
github-token: ${{ secrets.GH_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/commit-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ----------------------------------------------------------- #
# Note: this file originates in ahmadnassri/template-template #
# ----------------------------------------------------------- #

name: commit-lint

on: [push, pull_request]

jobs:
deduplicate:
timeout-minutes: 5

runs-on: ubuntu-latest

# run on external PRs, but not on our internal PRs
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository

steps:
- run: echo ::info ::de-duplicate ran successfully

commit-lint:
timeout-minutes: 5

needs: deduplicate

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ahmadnassri/action-commit-lint@v1
with:
config: .github/linters/.commit-lint.yml
54 changes: 54 additions & 0 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# ----------------------------------------------------------- #
# Note: this file originates in ahmadnassri/template-template #
# ----------------------------------------------------------- #

name: readme

on:
push:
branches: master
paths:
- docs/**
- colophon.yml
- .github/workflows/readme.yml

jobs:
readme:
timeout-minutes: 5

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: docker://pandoc/core:2.11.4
with:
args: >-
--metadata-file=colophon.yml
--template=docs/README.template
--output=README.md
--from=gfm
--to=gfm
--fail-if-warnings
--wrap=preserve
--reference-links
docs/README.md
- uses: actions/github-script@v3
with:
github-token: ${{secrets.GH_TOKEN}}
script: |
const { readFileSync } = require('fs')
const path = 'README.md'
const content = readFileSync(`${process.env.GITHUB_WORKSPACE}/${path}`)
const { data } = await github.repos.getContent({ ...context.repo, path })
if (Buffer.from(data.content, 'base64').compare(content) === 0) return
await github.repos.createOrUpdateFileContents({...context.repo, path,
sha: data.sha,
message: 'docs(readme): update readme',
content: content.toString('base64')
})
74 changes: 39 additions & 35 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,61 @@
# ----------------------------------------------------------- #
# Note: this file originates in ahmadnassri/template-node-lib #
# ----------------------------------------------------------- #

name: release

on:
push:
branches:
- master
workflow_run:
workflows: [ test ]
branches: [ master ]
types: [ completed ]

jobs:
dependencies:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/[email protected]

# run checks
- run: npm audit --audit-level=moderate
release:
timeout-minutes: 5

test:
needs: dependencies
runs-on: ubuntu-latest

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10, 12, 13, 14]
if: ${{ github.event.workflow_run.conclusion == 'success' }}

runs-on: ${{ matrix.os }}
outputs:
published: ${{ steps.release.outputs.published }}
version: ${{ steps.release.outputs.release-version }}

steps:
- uses: actions/checkout@v2

- uses: actions/[email protected]
with:
path: ~/.npm
key: client-${{ hashFiles('**/package-lock.json') }}
submodules: true

- uses: actions/[email protected]
- id: release
uses: ahmadnassri/action-semantic-release@v1
with:
node-version: ${{ matrix.node-version }}
config: ${{ github.workspace }}/.semantic.json
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

# run test
- run: npm ci
- run: npm run test
mirror:
needs: release

release:
needs: test
timeout-minutes: 5

runs-on: ubuntu-latest

if: needs.release.outputs.published == 'true'

steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: semantic-release
uses: ahmadnassri/action-semantic-release@v1
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ahmadnassri/action-github-registry-npm-proxy@v1
with:
github-token: ${{ secrets.GH_TOKEN }}
owner: ${{ github.repository_owner }}

- name: publish to github registry
run: |
jq '.name = "@'${GITHUB_REPOSITORY/node-/}'"' package.json > /tmp/package.json; mv /tmp/package.json .
npm version --no-git-tag-version v${{ needs.release.outputs.version }}
npm publish
28 changes: 24 additions & 4 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
# ----------------------------------------------------------- #
# Note: this file originates in ahmadnassri/template-template #
# ----------------------------------------------------------- #

name: super-linter

on: push
on: [ push, pull_request ]

jobs:
super-linter:
deduplicate:
timeout-minutes: 5

runs-on: ubuntu-latest

# run on external PRs, but on internal PRs as they'll be run by the push to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository

steps:
- run: echo ::info ::de-duplicate ran successfully

lint:
timeout-minutes: 5

needs: deduplicate

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: docker://github/super-linter:v3
- uses: github/super-linter@v3.15.1
env:
LOG_LEVEL: ERROR
VALIDATE_ALL_CODEBASE: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
Loading

0 comments on commit 34105cb

Please sign in to comment.