Skip to content

Commit d80652f

Browse files
authored
Add CI (#2)
2 parents 4a05b4d + ecf1de7 commit d80652f

File tree

5 files changed

+177
-1
lines changed

5 files changed

+177
-1
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.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
day: monday
8+
time: "06:00"
9+
reviewers:
10+
- cloudnode-pro/development
11+
12+
- package-ecosystem: github-actions
13+
directory: /
14+
schedule:
15+
interval: weekly
16+
day: monday
17+
time: "06:00"
18+
reviewers:
19+
- cloudnode-pro/development

.github/workflows/ci.yaml

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: 22
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-web-ts-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: 22
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-web-ts-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@v5
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.yaml

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cldn/web-ts",
3-
"version": "0.0.0",
3+
"version": "0.0.0-dev",
44
"description": "Class-based Node.js web server",
55
"main": "dist/index.js",
66
"type": "module",

0 commit comments

Comments
 (0)