Skip to content

Commit 57173fb

Browse files
committed
GLSP-1594: Switch to trusted publishing
- Setup trusted publishing for client - Remove client CI checks/publishs from Jenkins pipeline - Add new CI workflow for Client CI - Align prettier/eslint configs - Update to lerna 9.x - Add prepare-release workflow Part of eclipse-glsp/glsp/issues/1594
1 parent 8e58819 commit 57173fb

File tree

11 files changed

+1902
-1266
lines changed

11 files changed

+1902
-1266
lines changed

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI (Client)
2+
3+
concurrency:
4+
group: ci-${{ github.ref }}
5+
cancel-in-progress: true
6+
on:
7+
workflow_dispatch:
8+
push:
9+
branches: [master]
10+
pull_request:
11+
branches: [master]
12+
13+
jobs:
14+
build:
15+
name: Build
16+
timeout-minutes: 60
17+
runs-on: ubuntu-22.04
18+
steps:
19+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
20+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
21+
with:
22+
node-version: 20.x
23+
- name: Build
24+
working-directory: ./client
25+
run: yarn install
26+
- name: Check for uncommitted changes in yarn.lock
27+
run: |
28+
if git diff --name-only | grep -q "^client/yarn.lock"; then
29+
echo "::error::The yarn.lock file has uncommitted changes!"
30+
exit 1
31+
fi
32+
lint:
33+
name: Lint
34+
timeout-minutes: 60
35+
runs-on: ubuntu-22.04
36+
working-directory: ./client
37+
steps:
38+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
39+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
40+
with:
41+
node-version: 20.x
42+
- name: Install
43+
run: |
44+
yarn install
45+
- name: Create eslint json report
46+
run: |
47+
yarn lint:ci
48+
- name: Create summary
49+
if: always()
50+
run: |
51+
npm_config_yes=true npx github:10up/eslint-json-to-md#82ff16b --path ./eslint_report.json --output ./eslint_report.md
52+
cat eslint_report.md >> $GITHUB_STEP_SUMMARY
53+

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ defaults:
1414
run:
1515
working-directory: ./client
1616
on:
17-
push:
18-
branches: [master]
19-
pull_request:
20-
# The branches below must be a subset of the branches above
21-
branches: [master]
2217
schedule:
2318
- cron: "19 3 * * 5"
2419

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Prepare Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_type:
7+
description: 'Release type (major, minor, patch, next, or custom)'
8+
required: true
9+
type: choice
10+
options:
11+
- major
12+
- minor
13+
- patch
14+
- next
15+
- custom
16+
custom_version:
17+
description: 'Custom version (required if release_type is custom)'
18+
required: false
19+
type: string
20+
branch:
21+
description: 'Branch to use for the release repo (default: default branch)'
22+
required: false
23+
type: string
24+
draft:
25+
description: 'Create PR as draft'
26+
required: false
27+
type: boolean
28+
default: false
29+
30+
jobs:
31+
prepare-release:
32+
uses: eclipse-glsp/glsp/.github/workflows/prepare-release.yml@master
33+
with:
34+
release_type: ${{ inputs.release_type }}
35+
custom_version: ${{ inputs.custom_version }}
36+
release_repo: glsp-eclipse-integration
37+
branch: ${{ inputs.branch }}
38+
draft: ${{ inputs.draft }}

.github/workflows/publish.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: 'Publish to NPM'
2+
3+
on:
4+
workflow_run:
5+
workflows: ['CI']
6+
types:
7+
- completed
8+
branches: [master]
9+
workflow_call:
10+
inputs:
11+
ref:
12+
description: 'Git ref (branch, tag, or commit SHA) to checkout and publish'
13+
required: true
14+
type: string
15+
dist-tag:
16+
description: 'NPM dist-tag to use for publishing'
17+
required: false
18+
type: string
19+
default: 'next'
20+
workflow_dispatch:
21+
inputs:
22+
ref:
23+
description: 'Git ref (branch, tag, or commit SHA) to checkout and publish'
24+
required: true
25+
type: string
26+
dist-tag:
27+
description: 'NPM dist-tag to use for publishing'
28+
required: false
29+
type: choice
30+
options:
31+
- next
32+
- latest
33+
default: 'next'
34+
35+
permissions:
36+
contents: read
37+
id-token: write
38+
39+
jobs:
40+
publish:
41+
name: Build & Publish
42+
runs-on: ubuntu-22.04
43+
if: github.repository == 'eclipse-glsp/glsp-eclipse-integration' && (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call' || (github.event.workflow_run.conclusion == 'success'))
44+
steps:
45+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
46+
with:
47+
ref: ${{ inputs.ref || github.event.inputs.ref || github.event.workflow_run.head_commit.id || github.sha }}
48+
# Fetch all history for lerna to determine versions
49+
fetch-depth: 0
50+
51+
- name: Check for changes in "client/packages" directory
52+
id: check_changes
53+
run: |
54+
DIST_TAG="${{ inputs.dist-tag || github.event.inputs.dist-tag || 'next' }}"
55+
# For 'next' dist-tag: check for changes when triggered by workflow_run or workflow_call
56+
# For 'latest' dist-tag or workflow_dispatch: always publish
57+
if [[ "$DIST_TAG" == "next" ]] && [[ "${{ github.event_name }}" != "workflow_dispatch" ]]; then
58+
if git diff --name-only HEAD^ HEAD | grep -qE '^client/packages'; then
59+
echo "should_publish=true" >> $GITHUB_OUTPUT
60+
else
61+
echo "should_publish=false" >> $GITHUB_OUTPUT
62+
fi
63+
else
64+
echo "should_publish=true" >> $GITHUB_OUTPUT
65+
fi
66+
67+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
68+
if: steps.check_changes.outputs.should_publish == 'true'
69+
with:
70+
node-version: 20.x
71+
registry-url: 'https://registry.npmjs.org'
72+
73+
- name: Build
74+
working-directory: ./client
75+
if: steps.check_changes.outputs.should_publish == 'true'
76+
run: yarn
77+
78+
- name: Publish to NPM
79+
if: steps.check_changes.outputs.should_publish == 'true'
80+
working-directory: ./client
81+
run: |
82+
DIST_TAG="${{ inputs.dist-tag || github.event.inputs.dist-tag || 'next' }}"
83+
if [[ "$DIST_TAG" == "next" ]]; then
84+
yarn publish:next
85+
elif [[ "$DIST_TAG" == "latest" ]]; then
86+
yarn publish:latest
87+
else
88+
echo "Unknown dist-tag: $DIST_TAG"
89+
exit 1
90+
fi
91+
env:
92+
NPM_CONFIG_PROVENANCE: 'true'

Jenkinsfile

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@ pipeline {
126126
dir('server') {
127127
sh 'mvn checkstyle:check -B'
128128
}
129-
// Execute eslint checks
130-
dir('client') {
131-
sh 'yarn lint:ci'
132-
}
133129
}
134130
}
135131
}
@@ -142,12 +138,7 @@ pipeline {
142138
qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]]
143139

144140
// Record maven,java warnings
145-
recordIssues enabledForFailure: true, skipPublishingChecks:true, tools: [mavenConsole(), java()]
146-
147-
// Record & publish esLint issues
148-
recordIssues enabledForFailure: true, publishAllIssues: true, aggregatingResults: true,
149-
tools: [esLint(pattern: 'client/eslint.xml')],
150-
qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]]
141+
recordIssues enabledForFailure: true, skipPublishingChecks:true, tools: [mavenConsole(), java()]
151142
}
152143
}
153144
}
@@ -159,27 +150,11 @@ pipeline {
159150
expression {
160151
/* Only trigger the deployment job if the changeset contains changes in
161152
the `server` or `client/packages/` directory */
162-
sh(returnStatus: true, script: 'git diff --name-only HEAD^ | grep -q "^server\\|client/packages/"') == 0
153+
sh(returnStatus: true, script: 'git diff --name-only HEAD^ | grep -q "^server"') == 0
163154
}
164155
}
165156
}
166157
stages {
167-
stage('Deploy client (NPM)') {
168-
steps {
169-
container('ci') {
170-
timeout(30) {
171-
dir('client') {
172-
withCredentials([string(credentialsId: 'npmjs-token', variable: 'NPM_AUTH_TOKEN')]) {
173-
sh 'printf "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}\n" >> $WORKSPACE/client/.npmrc'
174-
}
175-
sh 'git config user.email "[email protected]"'
176-
sh 'git config user.name "eclipse-glsp-bot"'
177-
sh 'yarn publish:next'
178-
}
179-
}
180-
}
181-
}
182-
}
183158
stage('Deploy server (P2)') {
184159
steps {
185160
build job: 'deploy-ide-p2-nightly', wait: false

client/.eslintignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Compiled output
2+
**/dist/
3+
**/lib/
4+
**/node_modules/
5+
6+
# Build files
7+
**/.eslintrc.js
8+
**/esbuild.js
9+
10+
# Other generated files
11+
**/*.map
12+
13+
**/scripts/

client/.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
module.exports = {
33
root: true,
44
extends: '@eclipse-glsp',
5-
ignorePatterns: ['**/{node_modules,lib}', '**/.eslintrc.js'],
65

76
parserOptions: {
87
tsconfigRootDir: __dirname,

client/.prettierignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Build outputs
5+
lib/
6+
dist/
7+
8+
# Generated files
9+
*.min.js
10+
*.min.css
11+
12+
# Lock files
13+
package-lock.json
14+
yarn.lock
15+
examples/workflow-webapp/app
16+
# Logs
17+
*.log

client/package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,28 @@
1111
"app": "yarn --cwd examples/workflow-webapp",
1212
"build": "yarn compile && yarn app bundle",
1313
"check:headers": "glsp checkHeaders ../../glsp-eclipse-integration -t lastCommit -f ts tsx java -e \"**/src-gen/**\"",
14-
"check:pr": "yarn all && yarn check:headers",
14+
"check:pr": "yarn all && yarn format:check && yarn check:headers",
1515
"clean": "lerna run clean",
1616
"compile": "tsc -b",
1717
"copy:client": "copyfiles -f ./examples/workflow-webapp/app/* ../server/example/org.eclipse.glsp.ide.workflow.editor/diagram",
18+
"format": "prettier --write .",
19+
"format:check": "prettier --check .",
1820
"generate:index": "lerna run generate:index && yarn lint:fix",
1921
"lint": "eslint --ext .ts,.tsx .",
20-
"lint:ci": "yarn lint -o eslint.xml -f checkstyle",
22+
"lint:ci": "yarn lint --output-file eslint_report.json --format json",
2123
"lint:fix": " yarn lint --fix",
2224
"prepare": "yarn build && yarn copy:client",
23-
"publish:latest": "lerna publish from-git --no-git-reset --no-git-tag-version --no-verify-access --no-push",
25+
"publish:latest": "lerna publish from-package --no-git-reset -y",
2426
"publish:next": "lerna publish preminor --exact --canary --preid next --dist-tag next --no-git-reset --no-git-tag-version --no-push --ignore-scripts --yes",
25-
"publish:prepare": "lerna version --ignore-scripts --yes --no-push",
2627
"upgrade:next": "glsp updateNext",
2728
"watch": "concurrently --kill-others -n tsc,webapp -c red,yellow \"tsc -b -w --preserveWatchOutput\" \"yarn -s app watch\""
2829
},
2930
"devDependencies": {
3031
"@eclipse-glsp/dev": "next",
3132
"@types/node": "20.x",
3233
"copyfiles": "^2.4.1",
33-
"lerna": "^7.0.0",
34+
"lerna": "^9.0.0",
35+
"mocha-ctrf-json-reporter": "^0.0.9",
3436
"typescript": "^5.9.2"
3537
},
3638
"engines": {

client/tsconfig.eslint.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
"compilerOptions": {
44
"noEmit": true
55
},
6-
"exclude": ["**/node_modules", "**/.eslintrc.js"],
76
"include": ["packages/*/src", "examples/*/src"]
87
}

0 commit comments

Comments
 (0)