fix(js): resolve dependabot security alerts #193
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: JS Package | |
| on: | |
| push: | |
| branches: [main] | |
| paths: ["js/**", ".github/workflows/build-js.yml"] | |
| pull_request: | |
| branches: [main] | |
| paths: ["js/**", ".github/workflows/build-js.yml"] | |
| workflow_dispatch: | |
| env: | |
| CI_BUILD: true | |
| jobs: | |
| test: | |
| name: Test (Node ${{ matrix.node-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [20, 22, 24] | |
| defaults: | |
| run: | |
| working-directory: js/ | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Run tests | |
| run: npm run test | |
| publish: | |
| name: Publish | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: ${{ success() && !github.base_ref }} | |
| permissions: | |
| id-token: write # Required for OIDC provenance | |
| contents: read | |
| defaults: | |
| run: | |
| working-directory: js/ | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| fetch-depth: 0 # Full history needed for revision count | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
| with: | |
| node-version: 24 | |
| registry-url: https://registry.npmjs.org/ | |
| - name: Get revision number | |
| id: rev | |
| run: | | |
| LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | |
| if [ -z "$LATEST_TAG" ]; then | |
| echo "count=$(git rev-list --count HEAD)" >> $GITHUB_OUTPUT | |
| else | |
| echo "count=$(git rev-list --count ${LATEST_TAG}..HEAD)" >> $GITHUB_OUTPUT | |
| fi | |
| echo "Revision: $(cat $GITHUB_OUTPUT)" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Publish vista-sdk | |
| run: cp ./README.md ./packages/vista-sdk/README.md; cd packages/vista-sdk; npm version $(node -p "require('./package.json').version").${{ steps.rev.outputs.count }}; npm publish --access public --tag preview --provenance; | |
| - name: Publish vista-sdk-experimental | |
| run: cd packages/vista-sdk-experimental; npm version $(node -p "require('./package.json').version").${{ steps.rev.outputs.count }}; npm publish --access public --tag preview --provenance; |