Skip to content

Commit 06db1ef

Browse files
committed
.github & CI
1 parent 1079f3c commit 06db1ef

File tree

5 files changed

+175
-0
lines changed

5 files changed

+175
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @cloudnode-pro/development

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
day: "monday"
13+
time: "06:00"

.github/workflows/ci.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
build:
13+
name: Build
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
registry-url: https://registry.npmjs.org/
24+
cache: npm
25+
26+
- name: Install latest NPM
27+
run: npm i -g npm@latest
28+
29+
- name: Install dependencies
30+
run: npm ci
31+
32+
- name: Build
33+
run: npm run build
34+
35+
- name: Pack
36+
run: npm pack
37+
38+
- name: Upload package artifact
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: package
42+
path: cldn-ip-0.0.0-dev.tgz
43+
publish:
44+
name: Publish
45+
needs: build
46+
if: github.event_name == 'release'
47+
runs-on: ubuntu-latest
48+
permissions:
49+
contents: read
50+
id-token: write
51+
pages: write
52+
steps:
53+
- name: Checkout repository
54+
uses: actions/checkout@v4
55+
56+
- name: Setup Node.js
57+
uses: actions/setup-node@v4
58+
with:
59+
node-version: 20
60+
registry-url: https://registry.npmjs.org/
61+
cache: npm
62+
63+
- name: Install latest NPM
64+
run: npm i -g npm@latest
65+
66+
- name: Install dependencies
67+
run: npm ci
68+
69+
- name: Download build artifact
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: package
73+
path: ./package
74+
75+
- name: Extract build package
76+
working-directory: ./package
77+
run: tar -xzf cldn-ip-0.0.0-dev.tgz
78+
79+
- name: Set version from release tag
80+
run: npm version ${{ github.event.release.tag_name }} --git-tag-version=false
81+
82+
- name: Copy package.json to build package
83+
run: cp package.json package/package
84+
85+
- name: Publish release to NPM
86+
if: "!github.event.release.prerelease"
87+
working-directory: ./package/package
88+
run: npm publish --provenance --access public
89+
env:
90+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
91+
92+
- name: Publish release candidate to NPM
93+
if: github.event.release.prerelease
94+
working-directory: ./package/package
95+
run: npm publish --provenance --access public --tag rc
96+
env:
97+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
98+
99+
- name: Generate docs
100+
if: "!github.event.release.prerelease"
101+
run: npm run docs
102+
103+
- name: Set up GitHub pages
104+
if: "!github.event.release.prerelease"
105+
uses: actions/configure-pages@v4
106+
107+
- name: Upload docs artifact to pages
108+
if: "!github.event.release.prerelease"
109+
uses: actions/upload-pages-artifact@v3
110+
with:
111+
path: docs
112+
113+
- name: Deploy to GitHub Pages
114+
if: "!github.event.release.prerelease"
115+
id: deployment
116+
uses: actions/deploy-pages@v4

.github/workflows/codeql.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
- cron: "0 6 * * 1"
10+
11+
jobs:
12+
analyze:
13+
name: Analyse (${{ matrix.language }})
14+
runs-on: 'ubuntu-latest'
15+
timeout-minutes: 360
16+
permissions:
17+
security-events: write
18+
packages: read
19+
actions: read
20+
contents: read
21+
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
language: [javascript-typescript]
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
- name: Initialise CodeQL
32+
uses: github/codeql-action/init@v3
33+
with:
34+
languages: ${{ matrix.language }}
35+
build-mode: ${{ matrix.build-mode }}
36+
37+
- name: Perform CodeQL analysis
38+
uses: github/codeql-action/analyze@v3
39+
with:
40+
category: "/language:${{matrix.language}}"

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
"version": "0.0.0-dev",
44
"description": "IP address utility",
55
"main": "dist/index.js",
6+
"type": "module",
7+
"files": [
8+
"dist/**.js",
9+
"dist/**.d.ts"
10+
],
611
"scripts": {
712
"build": "tsc",
813
"docs": "typedoc src",

0 commit comments

Comments
 (0)