Publish @dotmatrixlabs/create-dotx-plugin #3
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: Publish @dotmatrixlabs/create-dotx-plugin | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Verify tag matches package version | |
| if: github.ref_type == 'tag' | |
| shell: bash | |
| run: | | |
| VERSION="$(node -p "require('./package.json').version")" | |
| EXPECTED_TAG="v${VERSION}" | |
| if [ "${GITHUB_REF_NAME}" != "${EXPECTED_TAG}" ]; then | |
| echo "Expected tag ${EXPECTED_TAG}, got ${GITHUB_REF_NAME}" | |
| exit 1 | |
| fi | |
| - name: Verify package contents | |
| run: npm pack --dry-run | |
| - name: Publish to npm | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: npm publish --access public --provenance |