Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerget committed Nov 30, 2023
0 parents commit b673146
Show file tree
Hide file tree
Showing 43 changed files with 21,573 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
env: { es2020: true },
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
parser: "@typescript-eslint/parser",
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
rules: {
"no-console": ["error", { allow: ["warn", "error"] }],
},
};
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
pull-request-branch-name:
separator: "-"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
pull-request-branch-name:
separator: "-"
7 changes: 7 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
repo:
- "*"

cicd:
- .github/*
- .github/**/*
20 changes: 20 additions & 0 deletions .github/workflows/00-init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Init Workflow

on:
workflow_call:

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
init:
name: Init
runs-on: ubuntu-latest
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4

- name: 🔄 Init Cache
uses: nmerget/npm-cache-action@main
21 changes: 21 additions & 0 deletions .github/workflows/00-scan-secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Leaked Secrets Scan

on:
workflow_call:

jobs:
TruffleHog:
name: Secrets Scan
runs-on: ubuntu-latest
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 🐷 TruffleHog OSS
uses: trufflesecurity/[email protected]
with:
path: ./
base: ${{ github.event.repository.default_branch }}
head: HEAD
25 changes: 25 additions & 0 deletions .github/workflows/01-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Build Workflow

on:
workflow_call:

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4

- name: 🔄 Init Cache
uses: nmerget/npm-cache-action@main

- name: 🔨 Build
run: npm run build

- name: ⏫ Upload build
uses: nmerget/upload-gzip-artifact@main
with:
name: build
path: dist
19 changes: 19 additions & 0 deletions .github/workflows/01-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Validate

on:
workflow_call:

jobs:
validate:
name: Validate
runs-on: ubuntu-latest
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4

- name: 🔄 Init Cache
uses: nmerget/npm-cache-action@main

- name: 🔬 Validate repo
run: npm run lint
19 changes: 19 additions & 0 deletions .github/workflows/01-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Test

on:
workflow_call:

jobs:
validate:
name: Test
runs-on: ubuntu-latest
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4

- name: 🔄 Init Cache
uses: nmerget/npm-cache-action@main

- name: 👨‍🔬👩‍🔬 Test repo
run: npm run test
37 changes: 37 additions & 0 deletions .github/workflows/02-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Publish

on:
workflow_call:

jobs:
validate:
name: Publish
runs-on: ubuntu-latest
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4

- name: 🔄 Init Cache
uses: nmerget/npm-cache-action@main

- name: ⏬ Download build
uses: nmerget/download-gzip-artifact@main
with:
name: build

- name: 🔀 Extract tag
shell: bash
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
id: extractTag

- name: 🔜 Publish to npm
env:
TAG: ${{ steps.extractTag.outputs.tag }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
SEMVER_VERSION=$(npx find-versions-cli "$TAG")
npm version --no-git-tag-version "$SEMVER_VERSION"
npm config set registry https://registry.npmjs.org/
npm set //registry.npmjs.org/:_authToken "$NPM_TOKEN"
npm publish
21 changes: 21 additions & 0 deletions .github/workflows/99-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Dependabot auto-merge
on:
workflow_call:

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: ⏬ Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'

- name: 🤖 Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
28 changes: 28 additions & 0 deletions .github/workflows/99-codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: 'CodeQL'
on:
workflow_call:

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: ['javascript']

steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4

- name: 🔄 Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: 🔨 Autobuild
uses: github/codeql-action/autobuild@v2

- name: 🔎 Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
14 changes: 14 additions & 0 deletions .github/workflows/99-dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: 'Dependency Review'
on:
workflow_call:

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4

- name: 🔎 Dependency Review
uses: actions/dependency-review-action@v3
14 changes: 14 additions & 0 deletions .github/workflows/99-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: 'Pull Request Labeler'
on:
workflow_call:

jobs:
triage:
runs-on: ubuntu-latest
steps:
- name: 🏷️ Labeler
uses: actions/labeler@v4
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
sync-labels: true
29 changes: 29 additions & 0 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Default Pipeline

on:
pull_request:
push:
branches:
- "main"

jobs:
init:
uses: ./.github/workflows/00-init.yml

scan-secrets:
uses: ./.github/workflows/00-scan-secrets.yml

build:
uses: ./.github/workflows/01-build.yml
needs: [init]
secrets: inherit

lint:
uses: ./.github/workflows/01-lint.yml
needs: [init]
secrets: inherit

test:
uses: ./.github/workflows/01-test.yml
needs: [init]
secrets: inherit
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish Pipeline

on:
release:
types: [published]

jobs:
init:
uses: ./.github/workflows/00-init.yml

scan-secrets:
uses: ./.github/workflows/00-scan-secrets.yml

build:
uses: ./.github/workflows/01-build.yml
needs: [init]
secrets: inherit

lint:
uses: ./.github/workflows/01-lint.yml
needs: [init]
secrets: inherit

test:
uses: ./.github/workflows/01-test.yml
needs: [init]
secrets: inherit

publish:
uses: ./.github/workflows/02-publish.yml
needs: [build, lint, test]
secrets: inherit
22 changes: 22 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: On Pull Request

on: pull_request

permissions:
pull-requests: write
contents: write
actions: read
security-events: write

jobs:
dependabot:
uses: ./.github/workflows/99-auto-merge.yml

codeql:
uses: ./.github/workflows/99-codeql-analysis.yml

dependency-review:
uses: ./.github/workflows/99-dependency-review.yml

labeler:
uses: ./.github/workflows/99-labeler.yml
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
*.swp

pids
logs
results
tmp

# Build
public/css/main.css

# Coverage reports
coverage

# API keys and secrets
.env

# Dependency directory
node_modules
bower_components

# Editors
.idea
*.iml

# OS metadata
.DS_Store
Thumbs.db

# Ignore built ts files
dist/**/*

# ignore yarn.lock
yarn.lock
/output/
/fonts/
Loading

0 comments on commit b673146

Please sign in to comment.