Skip to content

Commit b8ce8d5

Browse files
committed
ci: rehaul the pipeline (update + new steps)
1 parent 174af59 commit b8ce8d5

File tree

7 files changed

+370
-1129
lines changed

7 files changed

+370
-1129
lines changed

.github/workflows/release.yaml

+143-71
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,72 @@
11
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2-
# TODO: Clean-up
32
# See: https://github.com/JulianCataldo/gh-actions
43

5-
name: 'Release'
4+
# For matrix setup:
5+
# https://github.com/withastro/astro/blob/main/.github/workflows/ci.yml
6+
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow
7+
8+
name: CI / Release
69

710
on:
11+
workflow_dispatch:
812
push:
13+
paths-ignore:
14+
- .github/**
15+
- '!.github/workflows/release.yaml'
16+
- '**/*.md'
917
branches:
1018
- '([0-9])?(.{+([0-9]),x}).x'
11-
- 'main'
12-
- 'next'
13-
- 'next-major'
14-
- 'alpha'
15-
- 'beta'
19+
- main
20+
- next
21+
- next-major
22+
- alpha
23+
- beta
24+
- 'feat/*'
25+
- 'fix/*'
26+
# - to-integrate
27+
# - to-integrate-next
1628

1729
permissions:
18-
contents: 'read' # for checkout
30+
contents: read # for checkout
1931

2032
jobs:
2133
release:
22-
name: 'Release'
23-
runs-on: 'ubuntu-latest'
34+
name: CI / Release
35+
2436
permissions:
25-
contents: 'write' # to be able to publish a GitHub release
26-
issues: 'write' # to be able to comment on released issues
27-
pull-requests: 'write' # to be able to comment on released pull requests
28-
id-token: 'write' # to enable use of OIDC for npm provenance
37+
contents: write # to be able to publish a GitHub release
38+
issues: write # to be able to comment on released issues
39+
pull-requests: write # to be able to comment on released pull requests
40+
id-token: write # to enable use of OIDC for npm provenance
41+
42+
runs-on: ubuntu-latest
43+
# TODO:
44+
# runs-on: ${{ matrix.os }}
45+
# timeout-minutes: 25
46+
# # needs: build
47+
# strategy:
48+
# matrix:
49+
# OS: [ubuntu-latest]
50+
# NODE_VERSION: [18, 20]
51+
# include:
52+
# - os: macos-14
53+
# NODE_VERSION: 18
54+
# - os: windows-latest
55+
# NODE_VERSION: 18
56+
# fail-fast: false
57+
# env:
58+
# NODE_VERSION: ${{ matrix.NODE_VERSION }}
2959

3060
steps:
31-
# - name: "Harden Runner"
32-
# uses: "step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09" # v2.5.1
33-
# with:
34-
# egress-policy: "audit"
61+
# MARK: Setup GH Action
62+
63+
- name: 'Harden Runner'
64+
uses: 'step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142' # v2.7.0
65+
with:
66+
egress-policy: 'audit'
3567

36-
- name: 'Git checkout'
37-
uses: 'actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744' # v3.6.0
68+
- name: Git checkout
69+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
3870
# run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
3971
with:
4072
fetch-depth: 0
@@ -46,71 +78,101 @@ jobs:
4678
# GIT_AUTHOR_NAME: "GitHub Actions Shell"
4779
# EMAIL: "github-actions[bot]@users.noreply.github.com"
4880

49-
- name: 'Setup PNPM'
50-
uses: 'pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598' # v2.4.0
81+
# MARK: Setup Node env.
82+
83+
- name: Setup PNPM
84+
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
5185
with:
5286
run_install: false
5387

54-
- name: 'Use Node.js 20.6.1'
55-
uses: 'actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d' # v3.8.1
88+
- name: Use Node.js 22.2.0
89+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
5690
with:
5791
# registry-url: "https://registry.npmjs.org"
58-
node-version: '20.6.1'
59-
cache: 'pnpm'
92+
node-version: 22.2.0
93+
cache: pnpm
6094

61-
# @see: npm install -g npm@latest is necessary to make provenance available. More info: https://docs.npmjs.com/generating-provenance-statements
62-
# - name: "Upgrade npm to latest version"
63-
# run: "npm install --global [email protected]"
64-
# env:
65-
# SKIP_CHECK: "true"
95+
- name: Install packages
96+
shell: bash
97+
run: pnpm install --frozen-lockfile
6698

67-
# - name: "Check npm version"
68-
# run: "npm -v"
69-
# env:
70-
# SKIP_CHECK: "true"
99+
# TODO: More tests
100+
# - name: Syncpack Lint
101+
# shell: bash
102+
# run: node --run syncpack:lint
71103

72-
- name: 'Install packages'
73-
run: 'pnpm install --frozen-lockfile'
104+
# NOTE: Audit is for prod only because a lot of root packages (like lerna etc.)
105+
# are used old packages with intricate dependency trees, and they are
106+
# never shipped to the user. But that's not 100% optimal, as devDeps could
107+
# provoke some sec issues, too? A middleground is better than nothing and
108+
# regularly blocked releases for obscure root mono-repo tooling deps.
109+
- name: 'Verify the integrity of provenance attestations and registry signatures for installed [prod] dependencies'
110+
run: node --run audit
74111

75-
# - name: "Verify the integrity of provenance attestations and registry signatures for installed dependencies"
76-
# run: "pnpm audit signatures"
112+
# MARK: Lint/Checks pre-build
77113

78-
# - name: "npm v8.5+ requires workspaces-update to be set to false"
79-
# run: "echo 'workspaces-update=false' >> .npmrc"
114+
# TODO: Setup Husky etc.
115+
# - name: Lint last commit — Commitlint
116+
# shell: bash
117+
# run: node --run lint:commit
80118

81-
# - name: "Semantic Release"
82-
# if: "success()"
83-
# env:
84-
# GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
85-
# NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
86-
# GIT_AUTHOR_NAME: "github-actions-shell"
87-
# GIT_AUTHOR_EMAIL: "github-actions[bot]@users.noreply.github.com"
88-
# GIT_COMMITTER_NAME: "github-actions-shell"
89-
# GIT_COMMITTER_EMAIL: "github-actions[bot]@users.noreply.github.com"
90-
# run: "pnpm exec multi-semantic-release"
119+
# - name: Lint CSS — Stylelint
120+
# shell: bash
121+
# run: node --run lint:css
122+
123+
- name: Check all formatting — Prettier
124+
shell: bash
125+
run: node --run format
126+
127+
# MARK: Build packages
128+
129+
- name: Setup Turbo cache
130+
uses: dtinth/setup-github-actions-caching-for-turbo@a0e976d970c2a94366a26984efcef3030e2c0115 # v1.2.0
131+
132+
- name: Build all packages
133+
shell: bash
134+
run: node --run build
135+
136+
# MARK: Lint/Checks post-build
91137

92-
- name: 'Setup Turbo cache'
93-
uses: dtinth/setup-github-actions-caching-for-turbo@v1
138+
- name: Lint JS/TS — ESLint
139+
shell: bash
140+
run: node --run lint:es
94141

95-
- name: 'Build all packages'
96-
run: 'pnpm build'
142+
# MARK:Tests
97143

98-
- name: 'Create temporary NPM identity'
144+
- name: Tests — Units
145+
shell: bash
146+
run: node --run test:unit
147+
148+
# - name: Tests — Integration
149+
# shell: bash
150+
# run: node --run test:integration
151+
152+
# TODO: Build and launch example-app
153+
# - name: Tests — E2E
154+
# shell: bash
155+
# run: node --run test:e2e
156+
157+
# MARK: Publish packages
158+
159+
- name: Create temporary NPM identity # + Enable Provenance
99160
env:
100161
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
162+
# run: |
163+
# echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN\nprovenance=true" > .npmrc
164+
# echo "provenance=true" > .npmrc
101165
run: |
102166
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
103167
104-
- name: 'Git user configuration'
168+
- name: Git user configuration
105169
run: |
106170
git config --global user.name "${{ github.actor }}"
107171
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
108172
109-
# - name: 'Lerna version'
110-
# run: |
111-
# pnpm lerna version --conventional-commits --yes
112-
173+
# MARK: [MAIN]
113174
- name: 'Lerna publish [main]'
175+
# if: github.ref == 'refs/heads/to-integrate'
114176
if: github.ref == 'refs/heads/main'
115177
# https://github.com/lerna/lerna/issues/2532
116178
id: graduateRelease
@@ -119,7 +181,7 @@ jobs:
119181
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
120182
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}' # Not really needed (already global)
121183
run: |
122-
pnpm lerna publish --conventional-commits --exact --conventional-graduate --create-release=github --yes
184+
pnpm lerna publish --message 'chore: publish [main] release [skip ci]' --create-release=github --conventional-graduate --yes
123185
124186
- name: Bump Prod Version Fallback
125187
if: ${{ always() && steps.graduateRelease.outcome == 'failure' }}
@@ -129,18 +191,28 @@ jobs:
129191
run: |
130192
echo Falling back to non-graduate release due to https://github.com/lerna/lerna/issues/2532
131193
git stash
132-
pnpm lerna publish --conventional-commits --exact --create-release=github --yes
194+
pnpm lerna publish --message 'chore: publish [main] release [skip ci]' --create-release=github --yes
133195
196+
# # TRY: https://www.jessesquires.com/blog/2021/10/17/github-actions-workflows-for-automatic-rebasing-and-merging/
197+
# - name: Merge (rebase) back main into next
198+
# env:
199+
# GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
200+
# run: |
201+
# git checkout next
202+
# git rebase main
203+
# git push
204+
205+
# MARK: [NEXT]
134206
- name: 'Lerna publish [next]'
135207
if: github.ref == 'refs/heads/next'
208+
# if: github.ref == 'refs/heads/to-integrate-next'
136209
env:
137210
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}' # Not really needed (already global)
138-
run: |
139-
pnpm lerna publish --conventional-commits --exact --conventional-prerelease --canary --dist-tag=next --preid=next --yes
140211

141-
# pnpm publish -r
142-
143-
# - name: "Publish"
144-
# run: "pnpm publish -r"
145-
146-
# --changelog-preset conventionalcommits
212+
# --canary next
213+
# https://github.com/lerna/lerna/issues/1433
214+
# pnpm lerna publish --conventional-prerelease --dist-tag=next --preid=next --no-changelog --yes
215+
# pnpm lerna publish --conventional-prerelease --pre-dist-tag=next --preid=next --yes
216+
# pnpm lerna publish --force-publish='*' --canary --pre-dist-tag=next --preid=next --yes
217+
run: |
218+
pnpm lerna publish --message 'chore: publish [next] pre-release' --conventional-prerelease --pre-dist-tag=next --preid=next --yes

package.json

+36-15
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "@jsfe/root",
33
"version": "0.0.0",
44
"private": true,
5-
"homepage": "https://jsfe.js.org",
65
"description": "Effortless forms, with standards.",
6+
"homepage": "https://jsfe.js.org",
77
"repository": {
88
"type": "git",
99
"url": "https://github.com/json-schema-form-element/jsfe"
@@ -15,26 +15,24 @@
1515
"url": "https://www.juliancataldo.com"
1616
},
1717
"type": "module",
18-
"engines": {
19-
"node": ">=20.0.0"
20-
},
2118
"scripts": {
22-
"dev": "turbo run dev --filter=!@jsfe/example-app --filter=!@jsfe/e2e",
19+
"// publish:dry": "pnpm lerna publish --dry-run",
20+
"// test": "cd tests && pnpm test",
21+
"audit": "pnpm audit signatures --prod",
2322
"build": "turbo run build --filter=!@jsfe/example-app --filter=!@jsfe/e2e",
24-
"ts:build": "turbo run ts:build --filter=!@jsfe/example-app --filter=!@jsfe/e2e",
25-
"lint": "turbo run lint",
26-
"lint:fix": "turbo run lint:fix",
27-
"format": "turbo run format",
28-
"format:check": "turbo run format:check",
2923
"check": "pnpm run lint && pnpm run format:check",
24+
"dev": "turbo run dev --filter=!@jsfe/example-app --filter=!@jsfe/e2e",
25+
"format": "turbo run format",
26+
"format:fix": "turbo run format:fix",
3027
"gen:manifests": "./scripts/manifests.sh",
28+
"lint:es": "turbo run lint:es",
29+
"lint:es:fix": "turbo run lint:es:fix",
3130
"test": "vitest",
32-
"test:unit": "FORCE_COLOR=1 pnpm -r --parallel test:unit",
33-
"test:unit:dev": "FORCE_COLOR=1 pnpm -r --parallel test:unit:dev",
3431
"test:e2e": "pnpm --filter=@jsfe/e2e test",
3532
"test:e2e:dev": "pnpm --filter=@jsfe/e2e test:ui",
36-
"// test": "cd tests && pnpm test",
37-
"// publish:dry": "pnpm lerna publish --dry-run",
33+
"test:unit": "FORCE_COLOR=1 pnpm -r --parallel test:unit",
34+
"test:unit:dev": "FORCE_COLOR=1 pnpm -r --parallel test:unit:dev",
35+
"// ts:build": "turbo run ts:build --filter=!@jsfe/example-app --filter=!@jsfe/e2e",
3836
"util:scaffold": "plop --plopfile scripts/scaffold/plopfile.js",
3937
"util:sort": "keep-sorted packages/*/src/widgets/index.ts packages/*/src/styles.scss && sort-package-json packages/*/package.json"
4038
},
@@ -72,5 +70,28 @@
7270
"typedoc-plugin-markdown": "^4.6.2",
7371
"typescript": "^5.8.3"
7472
},
75-
"packageManager": "[email protected]"
73+
"packageManager": "[email protected]",
74+
"engines": {
75+
"node": ">=20.0.0"
76+
},
77+
"pnpm": {
78+
"overrides": {
79+
"array-includes": "npm:@nolyfill/array-includes@^1",
80+
"array.prototype.findlastindex": "npm:@nolyfill/array.prototype.findlastindex@^1",
81+
"array.prototype.flat": "npm:@nolyfill/array.prototype.flat@^1",
82+
"array.prototype.flatmap": "npm:@nolyfill/array.prototype.flatmap@^1",
83+
"es-set-tostringtag": "npm:@nolyfill/es-set-tostringtag@^1",
84+
"hasown": "npm:@nolyfill/hasown@^1",
85+
"is-core-module": "npm:@nolyfill/is-core-module@^1",
86+
"isarray": "npm:@nolyfill/isarray@^1",
87+
"object.assign": "npm:@nolyfill/object.assign@^1",
88+
"object.fromentries": "npm:@nolyfill/object.fromentries@^1",
89+
"object.groupby": "npm:@nolyfill/object.groupby@^1",
90+
"object.values": "npm:@nolyfill/object.values@^1",
91+
"safe-buffer": "npm:@nolyfill/safe-buffer@^1",
92+
"safer-buffer": "npm:@nolyfill/safer-buffer@^1",
93+
"string.prototype.trimend": "npm:@nolyfill/string.prototype.trimend@^1",
94+
"typedarray": "npm:@nolyfill/typedarray@^1"
95+
}
96+
}
7697
}

packages/engine/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,18 @@
5555
"// css:to-js": "node ../../scripts/css-to-js.js dist/esm/styles.css",
5656
"// css:to-js:dev": "nodemon dist/esm/styles.css -x 'pnpm css:to-js'",
5757
"// dev": "pnpm ts:dev & pnpm css:dev & (sleep 3 && pnpm css:to-js:dev)",
58-
"build": "pnpm clean ; pnpm ts:build || exit 0",
58+
"// build 2": "pnpm clean ; pnpm ts:build || exit 0",
59+
"// dev 2": "pnpm ts:dev",
5960
"clean": "rm -rf ./dist",
60-
"dev": "pnpm ts:dev",
61-
"ts:build": "pnpm tsc",
62-
"ts:dev": "pnpm tsc --watch",
61+
"build": "pnpm tsc",
62+
"dev": "pnpm tsc --watch",
6363
"test": "pnpm tsc",
6464
"test:unit": "node --test --test-reporter=spec --experimental-test-coverage --enable-source-maps 'dist/**/*.test.js'",
6565
"test:unit:dev": "node --test --enable-source-maps --watch 'dist/**/*.test.js'",
66-
"lint": "eslint --cache \"src/**/*.{ts,tsx,js}\"",
67-
"lint:fix": "eslint --fix --cache \"src/**/*.{ts,tsx,js}\"",
68-
"format": "prettier --cache --write \"src/**/*.{ts,tsx,js,json,md,yml}\"",
69-
"format:check": "prettier --cache --check \"src/**/*.{ts,tsx,js,json,md,yml}\""
66+
"lint:es": "eslint --cache \"src/**/*.{ts,tsx,js}\"",
67+
"lint:es:fix": "eslint --fix --cache \"src/**/*.{ts,tsx,js}\"",
68+
"format": "prettier --cache --check \"src/**/*.{ts,tsx,js,json,md,yml}\"",
69+
"format:fix": "prettier --cache --write \"src/**/*.{ts,tsx,js,json,md,yml}\""
7070
},
7171
"dependencies": {
7272
"@standard-schema/spec": "^1.0.0",

0 commit comments

Comments
 (0)