name: Build and Publish Httpsnippet on: push: branches: - master tags: - '*' # Restrict any specific tag formats pull_request: types: - opened - synchronize workflow_dispatch: jobs: scan: permissions: packages: write contents: write # publish sbom to GH releases/tag assets runs-on: ubuntu-latest steps: - name: Checkout branch uses: actions/checkout@v6 with: path: ${{ github.repository }} # Perform SCA analysis for the code repository # Produces SBOM and CVE report # Helps understand vulnerabilities / license compliance across third party dependencies - id: sca-project uses: Kong/public-shared-actions/security-actions/sca@a18abf762d6e2444bcbfd20de70451ea1e3bc1b1 with: dir: ${{ github.repository }} upload-sbom-release-assets: true build: needs: [scan] runs-on: ubuntu-latest strategy: fail-fast: false matrix: node-version: [20, 22, 24] steps: - name: Checkout branch uses: actions/checkout@v6 - name: Setup Node uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} - name: Install run: npm ci - name: Test run: npm run test - name: Lint run: npm run lint - name: Build run: npm run build publish: runs-on: ubuntu-latest permissions: contents: write id-token: write # For using token to sign images actions: read # For getting workflow run info to build provenance packages: write # Required for publishing provenance. Issue: https://github.com/slsa-framework/slsa-github-generator/tree/main/internal/builders/container#known-issues if: ${{ github.ref_type == 'tag' && github.repository_owner == 'Kong' }} steps: # checkout tag - name: Checkout code uses: actions/checkout@v6 with: fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v6 with: node-version: 24 registry-url: 'https://registry.npmjs.org' - name: Install run: npm ci - name: Build run: npm run build - name: Publish to NPM run: npm publish --no-git-checks --provenance --tag ${{ github.sha }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}