🚀 Publish to NPM Dev Channel #3
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
| name: Publish to NPM Dev Channel | |
| on: | |
| workflow_dispatch | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org/ | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Build project | |
| run: npm run build | |
| - name: Update package version | |
| id: update-version | |
| run: | | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") | |
| TIMESTAMP=$(date -u +"%Y%m%d%H%M%S") | |
| NEW_VERSION="${CURRENT_VERSION}-dev${TIMESTAMP}" | |
| npm version --no-git-tag-version $NEW_VERSION | |
| echo "New version: $NEW_VERSION" | |
| echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | |
| - name: Update package-lock.json | |
| run: npm install | |
| - name: Publish to NPM Dev Channel | |
| run: npm publish --tag dev | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |