Skip to content

Commit

Permalink
chore(template): update template structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Nassri committed Feb 9, 2021
1 parent b687505 commit fe7fc4d
Show file tree
Hide file tree
Showing 20 changed files with 5,471 additions and 153 deletions.
11 changes: 11 additions & 0 deletions .github/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- match:
dependency_type: development
update_type: semver:minor # includes patch updates!

- match:
dependency_type: production
update_type: security:minor # includes patch updates!

- match:
dependency_type: production
update_type: semver:patch
21 changes: 14 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
version: 2
updates:
- package-ecosystem: "github-actions"
- package-ecosystem: gitsubmodule
open-pull-requests-limit: 10
directory: "/"
directory: /
commit-message:
prefix: build
prefix-development: chore
include: scope
schedule:
interval: "daily"
interval: daily

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

interval: daily
4 changes: 4 additions & 0 deletions .github/linters/.commit-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends:
- "@commitlint/config-conventional"
rules:
body-max-line-length: [2, 'always', 200]
5 changes: 2 additions & 3 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,14 @@ MD032: true

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

# Bare URL used
MD034: true

# Horizontal rule style
MD035:
style: "---"

style: "----"

# Emphasis used instead of a heading
MD036:
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: auto-merge

on: pull_request

jobs:
auto-merge:
timeout-minutes: 5

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ahmadnassri/action-dependabot-auto-merge@v2
with:
github-token: ${{ secrets.GH_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/commit-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: commit-lint

on: [push, pull_request]

jobs:
commit-lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ahmadnassri/action-commit-lint@v1
with:
config: .github/linters/.commit-lint.yml
49 changes: 49 additions & 0 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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
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')
})
72 changes: 34 additions & 38 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,55 @@
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
- run: npx updated
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
- uses: actions/[email protected]

# release
- run: npx semantic-release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
submodules: true

- name: publish to github registry
run: |
jq '.name = "@'${GITHUB_REPOSITORY/node-/}'"' package.json > /tmp/package.json; mv /tmp/package.json .
npm config --userconfig .npmrc set registry=https://npm.pkg.github.com/${{ github.repository_owner }}
npm config --userconfig .npmrc set //npm.pkg.github.com/:_authToken ${{ secrets.GH_TOKEN }}
npm config --userconfig .npmrc set always-auth true
npm version --no-git-tag-version v${{ needs.release.outputs.version }}
npm publish
28 changes: 22 additions & 6 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
name: super-linter

on:
push:
branches-ignore:
- master
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 ::warning ::skipped duplicate run

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
env:
LOG_LEVEL: ERROR
VALIDATE_ALL_CODEBASE: false
GITHUB_TOKEN: ${{ github.token }}
53 changes: 34 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,59 @@
name: test

on:
push:
branches-ignore:
- master
on: [ push, pull_request ]

env:
NODE_ENV: test

jobs:
dependencies:
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:
- uses: actions/checkout@v2
- uses: actions/[email protected]
- run: echo ::warning ::skipped duplicate run

audit:
timeout-minutes: 5

# run checks
- run: npm audit --audit-level=moderate
- run: npx updated
needs: deduplicate

runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
- uses: actions/checkout@v2
- run: npm audit --audit-level=critical

test:
needs: dependencies
timeout-minutes: 5

needs: audit

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10, 12, 13, 14]
node-version: [12, 14, 15]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}

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

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

- uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
key: ${{ matrix.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}

# run test
- run: npm ci
- run: npm run test
- run: npm run test:ci
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
*.log
/.nyc_output
/coverage
/node_modules
.nyc_output
coverage
node_modules
19 changes: 0 additions & 19 deletions .releaserc

This file was deleted.

Loading

0 comments on commit fe7fc4d

Please sign in to comment.