Skip to content

Merge pull request #706 from microsoftgraph/dependabot/npm_and_yarn/m… #1287

Merge pull request #706 from microsoftgraph/dependabot/npm_and_yarn/m…

Merge pull request #706 from microsoftgraph/dependabot/npm_and_yarn/m… #1287

Workflow file for this run

# Temporary flow to test compilation of the generated requests
name: Node.js CI
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=9182"
environment:
name: build_test
strategy:
matrix:
node-version: [18.x, 20.x]
# Single version should work for compilation testing
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
- name: Check for Secret availability
id: my-key-check
# perform secret check & put boolean result as an output
shell: bash
run: |
if [ "${{ secrets.client_secret }}" != '' ]; then
echo "defined=true" >> $GITHUB_OUTPUT;
else
echo "defined=false" >> $GITHUB_OUTPUT;
fi
- run: npm run test
if: steps.my-key-check.outputs.defined == 'true'
env:
TENANT_ID: ${{secrets.tenant_id}}
CLIENT_ID: ${{secrets.client_id}}
CLIENT_SECRET: ${{secrets.client_secret}}
USER_ID: ${{secrets.user_id}}
# The check-build-matrix returns success if all matrix jobs in build are successful; otherwise, it returns a failure.
# Use this as a PR status check for GitHub Policy Service instead of individual matrix entry checks.
check-build-matrix:
runs-on: ubuntu-latest
needs: build
if: always()
steps:
- name: All build matrix options are successful
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: One or more build matrix options failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
publish-npm:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.actor == 'release-please[bot]'}}
needs: build
environment:
name: production_feed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npx lerna publish from-package --yes
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}