Skip to content

Commit

Permalink
chore(template): update template
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Nassri committed May 18, 2021
1 parent 6a4466e commit 878c1a3
Show file tree
Hide file tree
Showing 10 changed files with 312 additions and 286 deletions.
32 changes: 0 additions & 32 deletions .github/workflows/commit-lint.yml

This file was deleted.

112 changes: 112 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# ------------------------------------------------------------- #
# Note: this file is automatically managed in template-template #
# ------------------------------------------------------------- #

on: pull_request

name: pull_request

jobs:
pr-screen:
runs-on: ubuntu-20.04

# only run for external PRs
if: github.event.pull_request.head.repo.full_name != github.repository

steps:
- run: echo ::debug::pr screen complete
working-directory: ${{ github.workspace }}

commit-lint:
needs: pr-screen

timeout-minutes: 5

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: ahmadnassri/action-commit-lint@v1
with:
config: .github/linters/.commit-lint.yml

super-linter:
needs: pr-screen

timeout-minutes: 5

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: github/[email protected]
env:
LOG_LEVEL: ERROR
VALIDATE_ALL_CODEBASE: false
FILTER_REGEX_EXCLUDE: '/github/workspace/README.md|test/fixtures/*'
GITHUB_TOKEN: ${{ github.token }}

npm-audit:
needs: pr-screen

timeout-minutes: 5

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/[email protected]

- run: npm audit --audit-level=critical

test-strategy:
needs:
- commit-lint
- super-linter
- npm-audit

timeout-minutes: 5

runs-on: ubuntu-latest

outputs:
matrix: ${{ steps.parse.outputs.matrix }}

steps:
- uses: actions/checkout@v2
- id: parse
run: echo "::set-output name=matrix::$(jq -c . < .github/matrix.json)"

test-run:
needs: test-strategy

timeout-minutes: 5

name: ${{ matrix.name || format('node v{0} @ {1}', matrix.node-version, matrix.os) || 'test-step' }}

strategy:
matrix: ${{ fromJSON(needs.test-strategy.outputs.matrix) }}

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: ${{ matrix.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}

- run: npm ci
- run: npm run test:ci
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,34 @@
# Note: this file is automatically managed in template-template #
# ------------------------------------------------------------- #

name: auto-merge

on: pull_request_target

name: pull_request_target

jobs:
auto-merge:
# only run for dependabot
if: github.actor == 'dependabot[bot]'

timeout-minutes: 5

runs-on: ubuntu-latest

if: github.actor == 'dependabot[bot]'

steps:
- uses: actions/checkout@v2
- uses: ahmadnassri/[email protected]
with:
github-token: ${{ secrets.GH_TOKEN }}

template-sync:
timeout-minutes: 20

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: ahmadnassri/action-template-repository-sync@v1
with:
github-token: ${{ secrets.GH_TOKEN }}
dry-run: true
165 changes: 165 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# ------------------------------------------------------------- #
# Note: this file is automatically managed in template-template #
# ------------------------------------------------------------- #

on: push

name: push

jobs:
commit-lint:
timeout-minutes: 5

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: ahmadnassri/action-commit-lint@v1
with:
config: .github/linters/.commit-lint.yml

super-linter:
timeout-minutes: 5

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: github/[email protected]
env:
LOG_LEVEL: ERROR
VALIDATE_ALL_CODEBASE: false
FILTER_REGEX_EXCLUDE: '/github/workspace/README.md|test/fixtures/*'
GITHUB_TOKEN: ${{ github.token }}

npm-audit:
timeout-minutes: 5

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/[email protected]

- run: npm audit --audit-level=critical

test-strategy:
needs:
- commit-lint
- super-linter
- npm-audit

timeout-minutes: 5

runs-on: ubuntu-latest

outputs:
matrix: ${{ steps.parse.outputs.matrix }}

steps:
- uses: actions/checkout@v2
- id: parse
run: echo "::set-output name=matrix::$(jq -c . < .github/matrix.json)"

test-run:
needs: test-strategy

timeout-minutes: 5

name: ${{ matrix.name || format('node v{0} @ {1}', matrix.node-version, matrix.os) || 'test-step' }}

strategy:
matrix: ${{ fromJSON(needs.test-strategy.outputs.matrix) }}

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: ${{ matrix.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}

- run: npm ci
- run: npm run test:ci

release:
needs: test-run

# only runs on main branch
if: ${{ github.ref == 'refs/heads/master' }}

timeout-minutes: 20

runs-on: ubuntu-latest

outputs:
published: ${{ steps.release.outputs.published }}
version: ${{ steps.release.outputs.release-version }}

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

- id: release
uses: ahmadnassri/action-semantic-release@v1
with:
config: ${{ github.workspace }}/.semantic.json
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

mirror:
needs: release

timeout-minutes: 5

runs-on: ubuntu-latest

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

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

- uses: ahmadnassri/action-github-registry-npm-proxy@v2
with:
token: ${{ secrets.GH_TOKEN }}
scope: ${{ 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
template-sync:
needs: release

timeout-minutes: 20

runs-on: ubuntu-latest

steps:
- uses: ahmadnassri/action-workflow-queue@v1

- uses: actions/checkout@v2

- uses: ahmadnassri/action-template-repository-sync@v1
with:
github-token: ${{ secrets.GH_TOKEN }}
dry-run: true
Loading

0 comments on commit 878c1a3

Please sign in to comment.