Merge pull request #101 from BinkyLabs/dependabot/github_actions/depe… #182
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: "Build and Test" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - v* | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build the project | |
| run: npm run build | |
| - name: Run tests | |
| run: npm run test | |
| - name: Run linter | |
| run: npm run lint:check | |
| - name: Check code formatting | |
| run: npm run format:check | |
| - name: Pack the package | |
| run: npm pack | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: muzzle-package | |
| path: ./*.tgz | |
| publish-npm: | |
| runs-on: ubuntu-latest | |
| environment: npm | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build the project | |
| run: npm run build | |
| - run: npm install npm@11 -g # Use npm@11 to publish with OIDC | |
| - run: | | |
| Copy-Item LICENSE @binkylabs/muzzle/ -Verbose | |
| Copy-Item README.md @binkylabs/muzzle/ -Verbose | |
| Copy-Item CHANGELOG.md @binkylabs/muzzle/ -Verbose | |
| shell: pwsh | |
| - name: Publish package on NPM | |
| run: npm publish --access public --provenance --workspaces |