name: NPM

concurrency:
    group: NPM-${{ github.workflow }}-${{ github.ref }}
    cancel-in-progress: true

permissions:
    security-events: write
    contents: write
    pull-requests: write

on:
    workflow_dispatch:
    release:
        types: [created]
    workflow_call:

jobs:
    Publish:
        runs-on: ubuntu-latest
        environment: Release
        env:
            ADBLOCK: true
            ASTRO_TELEMETRY_DISABLED: 1
            AUTOMATEDLAB_TELEMETRY_OPTOUT: 1
            AZURE_CORE_COLLECT_TELEMETRY: 0
            CHOOSENIM_NO_ANALYTICS: 1
            DIEZ_DO_NOT_TRACK: 1
            DO_NOT_TRACK: 1
            DOTNET_CLI_TELEMETRY_OPTOUT: 1
            DOTNET_INTERACTIVE_CLI_TELEMETRY_OPTOUT: 1
            ET_NO_TELEMETRY: 1
            GATSBY_TELEMETRY_DISABLED: 1
            GATSBY_TELEMETRY_OPT_OUT: 1
            GATSBY_TELEMETRY_OPTOUT: 1
            GRIT_TELEMETRY_DISABLED: 1
            HASURA_GRAPHQL_ENABLE_TELEMETRY: false
            HINT_TELEMETRY: off
            HOMEBREW_NO_ANALYTICS: 1
            INFLUXD_REPORTING_DISABLED: true
            ITERATIVE_DO_NOT_TRACK: 1
            NEXT_TELEMETRY_DEBUG: 1
            NEXT_TELEMETRY_DISABLED: 1
            NG_CLI_ANALYTICS: false
            NUXT_TELEMETRY_DISABLED: 1
            PIN_DO_NOT_TRACK: 1
            POWERSHELL_TELEMETRY_OPTOUT: 1
            SAM_CLI_TELEMETRY: 0
            STNOUPGRADE: 1
            STRIPE_CLI_TELEMETRY_OPTOUT: 1
            TELEMETRY_DISABLED: 1
            TERRAFORM_TELEMETRY: 0
            VCPKG_DISABLE_METRICS: 1

        permissions:
            contents: read
            id-token: write

        steps:
            - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

            - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
              with:
                  node-version: "24"

            - run: npm install -g npm@latest
              continue-on-error: true
