Repository navigation
Automate package publishing via CI/CD #1
Workflow file for this run
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
| # Prerelease packages are published to the 'dev' tag on npm on every update to main | ||
| name: Publish prerelease package | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| permissions: | ||
| id-token: write | ||
| jobs: | ||
| prerelease: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 24 | ||
| registry-url: 'https://registry.npmjs.org/' | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Bump prerelease version based on latest stable version tag | ||
| id: latest | ||
| run: | | ||
| LATEST_TAG=$(git tag --list "v*.*.*" --sort=-v:refname | grep -v '-' | head -n1) | ||
| npm version "$${LATEST_TAG#v}" --no-git-tag-version | ||
| npm version prerelease --preid="dev.${{ github.sha::7 }}" --no-git-tag-version | ||
| echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | ||
| - name: Publish prerelease to npm (with 'dev' tag) | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| run: npm publish --tag dev --access public | ||