diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 78ec63d..6e2165c 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -9,13 +9,16 @@ on: permissions: contents: read +env: + NODE_VERSION: '24.x' + jobs: build: runs-on: ubuntu-latest strategy: matrix: - node-version: [16, 18, 20] + node-version: [16.x, 18.x, 20.x, 22.x, 24.x] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -48,15 +51,12 @@ jobs: - name: Set up node uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: - node-version: 20 + node-version: ${{ env.NODE_VERSION }} cache: "npm" - name: Install dependencies run: npm ci - - name: Audit dependencies - run: npm audit - - name: Check for circular dependencies run: npx madge --circular . --extensions ts,js @@ -70,9 +70,29 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} slug: openfga/js-sdk + audit: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + + - name: Set up node + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: ${{ env.NODE_VERSION }} + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Audit dependencies + run: npm audit + publish: if: startsWith(github.ref, 'refs/tags/v') - needs: [build, test] + needs: [build, test, audit] runs-on: ubuntu-latest permissions: @@ -87,7 +107,7 @@ jobs: - name: Set up node uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: - node-version: 20 + node-version: ${{ env.NODE_VERSION }} registry-url: "https://registry.npmjs.org" scope: "@openfga" always-auth: false diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 10d715b..0365f97 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -37,6 +37,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false + fetch-depth: 0 - name: "Run analysis" uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1