Skip to content

Commit 64095e2

Browse files
committed
ci: setup
Signed-off-by: TimoGlastra <timo@animo.id>
1 parent e179b6b commit 64095e2

18 files changed

Lines changed: 1624 additions & 1396 deletions

‎.changeset/commit.js‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const { execSync } = require('node:child_process')
2+
3+
const getSignedOffBy = () => {
4+
const gitUserName = execSync('git config user.name').toString('utf-8').trim()
5+
const gitEmail = execSync('git config user.email').toString('utf-8').trim()
6+
7+
return `Signed-off-by: ${gitUserName} <${gitEmail}>`
8+
}
9+
10+
const getAddMessage = async (changeset) => {
11+
return `docs(changeset): ${changeset.summary}\n\n${getSignedOffBy()}\n`
12+
}
13+
14+
const getVersionMessage = async () => {
15+
return `chore(release): new version\n\n${getSignedOffBy()}\n`
16+
}
17+
18+
module.exports = {
19+
getAddMessage,
20+
getVersionMessage,
21+
}

‎.changeset/config.json‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{
2-
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
2+
"$schema": "https://unpkg.com/@changesets/config@3.0.1/schema.json",
33
"changelog": "@changesets/cli/changelog",
4-
"commit": false,
4+
"commit": "./commit.js",
55
"privatePackages": false,
6-
"prettier": false,
7-
"fixed": [["**"]],
6+
"fixed": [["@owf/*"]],
87
"access": "public",
98
"baseBranch": "main",
109
"updateInternalDependencies": "patch",

‎.github/dependabot.yml‎

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
version: 2
2+
updates:
3+
# NPM dependencies
4+
- package-ecosystem: "npm"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
time: "09:00"
10+
timezone: Europe/Amsterdam
11+
# Wait before proposing freshly published versions (supply-chain safety,
12+
# and avoids PRs that get superseded by a quick follow-up release).
13+
cooldown:
14+
default-days: 3
15+
semver-major-days: 7
16+
open-pull-requests-limit: 10
17+
# A dependency lands in the first group it matches, so order matters.
18+
groups:
19+
# All security fixes in one PR
20+
npm-security:
21+
applies-to: security-updates
22+
patterns:
23+
- "*"
24+
# All non-breaking updates in one PR
25+
npm-minor-patch:
26+
patterns:
27+
- "*"
28+
update-types:
29+
- "minor"
30+
- "patch"
31+
# Major updates of packages that must move together
32+
vitest:
33+
patterns:
34+
- "vitest"
35+
- "@vitest/*"
36+
- "vite"
37+
# Remaining major updates are created individually
38+
# Enable version updates for all severity levels
39+
allow:
40+
- dependency-type: "all"
41+
ignore:
42+
# Auto update does not work well with biome.json schema version
43+
- dependency-name: "@biomejs/biome"
44+
# Labels for PRs
45+
labels:
46+
- "dependencies"
47+
- "npm"
48+
49+
# Commit message configuration
50+
commit-message:
51+
prefix: "chore"
52+
prefix-development: "chore"
53+
include: "scope"
54+
55+
# GitHub Actions dependencies (pinned by commit SHA with a "# vX.Y.Z" comment)
56+
- package-ecosystem: "github-actions"
57+
directory: "/"
58+
schedule:
59+
interval: "weekly"
60+
day: "monday"
61+
time: "09:00"
62+
timezone: Europe/Amsterdam
63+
# The semver-*-days options are not supported for github-actions.
64+
cooldown:
65+
default-days: 3
66+
# A dependency lands in the first group it matches, so order matters.
67+
groups:
68+
# CodeQL sub-actions (init/analyze/upload-sarif) must share one version,
69+
# otherwise the analyze step fails, so they are always bumped together.
70+
codeql-action:
71+
patterns:
72+
- "github/codeql-action*"
73+
# All other non-breaking updates in one PR
74+
actions-minor-patch:
75+
patterns:
76+
- "*"
77+
update-types:
78+
- "minor"
79+
- "patch"
80+
# Remaining major updates are created individually
81+
labels:
82+
- "dependencies"
83+
- "github-actions"
84+
commit-message:
85+
prefix: "ci"

‎.github/workflows/ci.yml‎

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Continuous Integration
2+
3+
on:
4+
pull_request_review:
5+
6+
pull_request:
7+
branches:
8+
- main
9+
push:
10+
branches:
11+
- main
12+
13+
merge_group:
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
validate:
20+
if: github.event_name != 'pull_request_review' || github.event.pull_request.head.ref == 'changeset-release/main'
21+
runs-on: ubuntu-24.04
22+
name: Validate
23+
steps:
24+
- name: Checkout Repo
25+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
26+
27+
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
28+
- name: Setup NodeJS
29+
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
30+
with:
31+
node-version: 24
32+
cache: "pnpm"
33+
34+
- name: Install dependencies
35+
run: pnpm install --frozen-lockfile
36+
37+
- name: Check Style
38+
run: pnpm style:check
39+
40+
- name: Check Types
41+
run: pnpm types:check
42+
43+
- name: Check Package Entrypoints
44+
run: pnpm packages:check
45+
46+
- name: Compile
47+
run: pnpm build
48+
49+
- name: Check Package Imports
50+
run: pnpm esm:check
51+
52+
tests:
53+
runs-on: ubuntu-24.04
54+
name: Tests
55+
if: github.event_name != 'pull_request_review' || github.event.pull_request.head.ref == 'changeset-release/main'
56+
57+
strategy:
58+
fail-fast: false
59+
matrix:
60+
node-version: [22, 24, 26]
61+
62+
steps:
63+
- name: Checkout Repo
64+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
65+
66+
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
67+
- name: Setup NodeJS
68+
id: setup-node
69+
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
70+
with:
71+
node-version: ${{ matrix.node-version }}
72+
73+
# See https://github.com/actions/setup-node/issues/641#issuecomment-1358859686
74+
- name: pnpm cache path
75+
id: pnpm-cache-path
76+
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
77+
78+
- name: pnpm cache
79+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
80+
with:
81+
path: ${{ steps.pnpm-cache-path.outputs.STORE_PATH }}
82+
key: ${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
83+
restore-keys: |
84+
${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-pnpm-store-
85+
86+
- name: Install dependencies
87+
run: pnpm install --frozen-lockfile
88+
89+
- name: Run tests
90+
run: pnpm test

‎.github/workflows/codeql.yml‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: "CodeQL SAST Security Analysis"
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
schedule:
9+
- cron: "0 6 * * 1"
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
analyze:
16+
name: CodeQL Analysis (${{ matrix.language }})
17+
runs-on: ubuntu-latest
18+
permissions:
19+
security-events: write
20+
actions: read
21+
contents: read
22+
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
language: ["javascript-typescript"]
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
31+
with:
32+
persist-credentials: false
33+
34+
- name: Initialize CodeQL
35+
uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
36+
with:
37+
languages: ${{ matrix.language }}
38+
build-mode: none
39+
40+
- name: Perform CodeQL Analysis
41+
uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
42+
with:
43+
category: "/language:${{ matrix.language }}"
44+
upload: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}

‎.github/workflows/release.yml‎

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency: ${{ github.workflow }}-${{ github.ref }}
12+
13+
jobs:
14+
release-stable:
15+
runs-on: ubuntu-24.04
16+
name: Release Stable
17+
env:
18+
NPM_CONFIG_PROVENANCE: "true"
19+
permissions:
20+
contents: write
21+
id-token: write # Needed for npm trusted publishing
22+
pull-requests: write
23+
outputs:
24+
published: ${{ steps.changesets.outputs.published }}
25+
steps:
26+
- name: Checkout Repo
27+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
28+
29+
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
30+
31+
- name: Setup NodeJS
32+
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
33+
with:
34+
node-version: 24
35+
cache: "pnpm"
36+
37+
- name: Install Dependencies
38+
run: pnpm install --frozen-lockfile
39+
40+
- name: Configure Git
41+
run: |
42+
git config --global user.name "github-actions[bot]"
43+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
44+
45+
- name: Create Release Pull Request or Publish to npm
46+
id: changesets
47+
uses: changesets/action@ae32849d5ba541f9ae29e40e22a623bc13562f51 # v2.1.2
48+
with:
49+
pr-title: "chore(release): new version"
50+
commit-message: "chore(release): new version"
51+
publish-script: pnpm release
52+
version-script: pnpm changeset-version
53+
push-with-git-cli: true
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
57+
- name: Get current package version
58+
id: get_version
59+
run: echo "current_package_version=$(node -p "require('./pex/package.json').version")" >> $GITHUB_OUTPUT
60+
61+
- name: Create Github Release
62+
if: "startsWith(github.event.head_commit.message, 'chore(release): new version')"
63+
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
64+
with:
65+
tag_name: v${{ steps.get_version.outputs.current_package_version }}
66+
67+
release-unstable:
68+
runs-on: ubuntu-24.04
69+
name: Release Unstable
70+
needs: release-stable
71+
if: always() && github.event_name == 'push' && needs.release-stable.outputs.published == 'false'
72+
env:
73+
NPM_CONFIG_PROVENANCE: "true"
74+
permissions:
75+
contents: write
76+
id-token: write # Needed for npm trusted publishing
77+
steps:
78+
- name: Checkout Repo
79+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
80+
81+
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
82+
83+
- name: Setup NodeJS
84+
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
85+
with:
86+
node-version: 24
87+
cache: "pnpm"
88+
89+
- name: Install Dependencies
90+
run: pnpm install --frozen-lockfile
91+
92+
- name: Create unstable release
93+
env:
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95+
run: |
96+
# ensure there's always a patch release created
97+
cat << 'EOF' > .changeset/snapshot-template-changeset.md
98+
---
99+
'@owf/pex': patch
100+
---
101+
102+
snapshot release
103+
EOF
104+
105+
pnpm changeset version --snapshot alpha
106+
pnpm style:fix
107+
pnpm types:check
108+
pnpm build
109+
pnpm esm:check
110+
pnpm changeset publish --tag alpha
111+
112+
CURRENT_PACKAGE_VERSION=$(node -p "require('./pex/package.json').version")
113+
git config --global user.name "github-actions[bot]"
114+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
115+
git tag v$CURRENT_PACKAGE_VERSION
116+
git push origin v$CURRENT_PACKAGE_VERSION --no-verify

0 commit comments

Comments
 (0)