Skip to content

Commit 33ea4c3

Browse files
committed
Add GitHub workflows for dependency review, ESLint, CodeQL analysis, and npm publishing
1 parent e1d6bda commit 33ea4c3

File tree

5 files changed

+186
-0
lines changed

5 files changed

+186
-0
lines changed

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "npm" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"
12+
13+
- package-ecosystem: "github-actions"
14+
directory: "/"
15+
schedule:
16+
interval: "weekly"

.github/workflows/build.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Check building and linting
2+
3+
on:
4+
push:
5+
branches-ignore: [ "main" ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ "**" ]
9+
10+
jobs:
11+
eslint:
12+
name: Run ESLint
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
pull-requests: read
17+
steps:
18+
- name: Set up NodeJS LTS
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 'lts/*'
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
- name: Install dependencies
25+
run: npm i
26+
- name: Run ESLint
27+
run: npm run lint

.github/workflows/codeql.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches:
17+
- "**"
18+
pull_request:
19+
# The branches below must be a subset of the branches above
20+
branches:
21+
- "**"
22+
schedule:
23+
- cron: '34 0 * * 2'
24+
25+
jobs:
26+
analyze:
27+
name: Analyze
28+
# Runner size impacts CodeQL analysis time. To learn more, please see:
29+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
30+
# - https://gh.io/supported-runners-and-hardware-resources
31+
# - https://gh.io/using-larger-runners
32+
# Consider using larger runners for possible analysis time improvements.
33+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
34+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
35+
permissions:
36+
actions: read
37+
contents: read
38+
security-events: write
39+
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
language: [ 'javascript-typescript' ]
44+
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
45+
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
46+
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
47+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
48+
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@v4
52+
53+
# Initializes the CodeQL tools for scanning.
54+
- name: Initialize CodeQL
55+
uses: github/codeql-action/init@v3
56+
with:
57+
languages: ${{ matrix.language }}
58+
# If you wish to specify custom queries, you can do so here or in a config file.
59+
# By default, queries listed here will override any specified in a config file.
60+
# Prefix the list here with "+" to use these queries and those in the config file.
61+
62+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
63+
# queries: security-extended,security-and-quality
64+
65+
66+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
67+
# If this step fails, then you should remove it and run the build manually (see below)
68+
- name: Autobuild
69+
uses: github/codeql-action/autobuild@v3
70+
71+
# ℹ️ Command-line programs to run using the OS shell.
72+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
73+
74+
# If the Autobuild fails above, remove it and uncomment the following three lines.
75+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
76+
77+
# - run: |
78+
# echo "Run, Build Application using script"
79+
# ./location_of_script_within_repo/buildscript.sh
80+
81+
- name: Perform CodeQL Analysis
82+
uses: github/codeql-action/analyze@v3
83+
with:
84+
category: "/language:${{matrix.language}}"

.github/workflows/dependency.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: 'Dependency Review'
2+
on: [pull_request]
3+
4+
permissions:
5+
contents: read
6+
7+
jobs:
8+
dependency-review:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: 'Checkout Repository'
12+
uses: actions/checkout@v4
13+
- name: 'Dependency Review'
14+
uses: actions/dependency-review-action@v4

.github/workflows/npm.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 'Publish to npm'
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
publish:
8+
name: Publish to npm
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
id-token: write
13+
steps:
14+
- name: Set up NodeJS LTS
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: 'lts/*'
18+
registry-url: 'https://registry.npmjs.org'
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
- name: Install dependencies
22+
run: npm i
23+
- name: Build
24+
run: npm run build
25+
- name : Publish to npm
26+
run: npm publish --provenance --access public
27+
env:
28+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
29+
purge:
30+
name: Purge jsdelivr cache
31+
runs-on: ubuntu-latest
32+
permissions:
33+
contents: read
34+
actions: read
35+
steps:
36+
- name: Set up NodeJS LTS
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 'lts/*'
40+
- name: Purge jsdelivr cache
41+
uses: List-KR/jsdelivr-purge-npm@1.0.5
42+
with:
43+
package: '@list-kr/tinyshield'
44+
disttag: 'latest'
45+
needs: [publish]

0 commit comments

Comments
 (0)