RDM-[11157,11158,11159,11187] : [JS-SDK]-Enhancements, Callbacks and Error Surfacing #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
branches: | |
- main | |
- development | |
- release-** | |
- hotfix-** | |
paths: | |
- "libs/**" | |
- "!README.md" | |
- "!.github/workflows/**" | |
push: | |
branches: | |
- main | |
- development | |
- release-** | |
- hotfix-** | |
paths: | |
- "libs/**" | |
- "!README.md" | |
- "!.github/workflows/**" | |
env: | |
node-version: "21.x" | |
NODE_AUTH_TOKEN: "${{ secrets.NPM_REGISTRY_ACCESS_TOKEN}}" | |
registry_url: "${{ vars.REGISTRY_BASE_URL }}" | |
github-token: "${{ secrets.PTA }}" | |
jobs: | |
detect-changes: | |
name: "Detect Changed Libraries" | |
runs-on: ubuntu-22.04 | |
outputs: | |
diff: ${{ steps.diff.outputs.all_modified_files }} | |
any_modified: ${{ steps.diff.outputs.any_modified }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ env.github-token }} | |
- name: Calculate file differences | |
id: diff | |
uses: tj-actions/changed-files@v35 | |
with: | |
dir_names: true | |
dir_names_max_depth: 2 | |
json: true | |
json_raw_format: true | |
files: | | |
libs/** | |
!README.md | |
!.github/workflows/** | |
- name: Print modified directories | |
run: | | |
echo "Modified directories: ${{ steps.diff.outputs.all_modified_files }}" | |
build-and-publish: | |
name: "Build and Publish Libraries" | |
needs: detect-changes | |
if: needs.detect-changes.outputs.any_modified == 'true' | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
id-token: write | |
strategy: | |
matrix: | |
lib_path: ${{ fromJson(needs.detect-changes.outputs.diff) }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ env.github-token }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "${{ env.node-version }}" | |
registry-url: "${{ env.registry_url }}" | |
- name: Install dependencies | |
run: npm ci | |
env: | |
NODE_AUTH_TOKEN: "${{ env.NODE_AUTH_TOKEN }}" | |
- name: Build and publish library | |
run: | | |
echo "Processing library: ${{ matrix.lib_path }}" | |
cd ${{ matrix.lib_path }} | |
npm run build | |
npm publish | |
cd ../.. | |
env: | |
NODE_AUTH_TOKEN: "${{ env.NODE_AUTH_TOKEN }}" | |
- name: Summary | |
if: always() | |
run: | | |
echo 'Build and publish completed for ${{ matrix.lib_path }}' | |
echo 'Published to: ${{ env.registry_url }}' |