Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,73 @@ jobs:
npm_config_legacy_peer_deps: "true"
run: npx @vscode/vsce publish --no-dependencies --pat ${{ secrets.VSCE_PAT }}

publish-npm-packages:
if: needs.release.outputs.publish == 'true'
runs-on: ubuntu-latest
needs: [release]
permissions:
contents: read
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 23.x
registry-url: 'https://registry.npmjs.org'

- name: Configure npm for OIDC-based publishing
run: |
# setup-node writes a placeholder _authToken (XXXXX-XXXXX-XXXXX-XXXXX) into
# .npmrc and exports NODE_AUTH_TOKEN with the same placeholder. npm uses this
# token as-is for registry auth → 404. Remove it so npm falls back to OIDC.
sed -i '/_authToken/d' "$NPM_CONFIG_USERCONFIG"
echo "NODE_AUTH_TOKEN=" >> "$GITHUB_ENV"

- name: Upgrade npm for trusted publishing (requires >= 11.5.1)
run: |
npm install -g npm@11
NPM_VER="$(npm --version)"
node -e "
const v = '$NPM_VER'.split('.').map(Number);
if (v[0] < 11 || (v[0] === 11 && v[1] < 5) || (v[0] === 11 && v[1] === 5 && v[2] < 1)) {
console.error('npm >= 11.5.1 is required for trusted publishing, got $NPM_VER');
process.exit(1);
}
"

- uses: actions/cache@v4
id: yarn-cache
with:
path: |
.yarn/cache
**/node_modules
**/.eslintcache
**/yarn.lock
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}

- name: Yarn install
run: yarn

- name: Build language service
run: yarn workspace @cratis/screenplay-language build

- name: Set package version
working-directory: ./Source/Screenplay/Monaco/screenplay-language
# Same reasoning as the VSCode extension step above - avoid npm version's own
# git/workspace-protocol handling and just write the version field directly.
run: npm pkg set version=${{ needs.release.outputs.version }}

- name: Publish to npm
working-directory: ./Source/Screenplay/Monaco/screenplay-language
run: npm publish --provenance

- name: Git reset (package.json version changed)
run: git reset --hard

publish-dotnet-packages:
if: needs.release.outputs.publish == 'true'
runs-on: ubuntu-latest
Expand Down
13 changes: 12 additions & 1 deletion Source/Screenplay/Monaco/screenplay-language/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,21 @@
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./capture": {
"types": "./dist/sub-languages/capture/index.d.ts",
"import": "./dist/sub-languages/capture/index.js"
},
"./projection": {
"types": "./dist/sub-languages/projection/index.d.ts",
"import": "./dist/sub-languages/projection/index.js"
}
},
"files": [
Expand All @@ -27,7 +38,7 @@
"monaco-editor": ">=0.44.0"
},
"devDependencies": {
"monaco-editor": "^0.52.2",
"monaco-editor": "^0.55.1",
"typescript": "6.0.3"
}
}
Loading
Loading