Merge pull request #7 from EnzoVezzaro/development #7
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 Package to npm | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| # Automatically bump the version | |
| - name: Bump version | |
| run: | | |
| echo "Bumping version..." | |
| npm version patch --no-git-tag-version | |
| - name: Commit and push version update | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "[email protected]" | |
| git add package.json package-lock.json | |
| git commit -m "Bump version to $(node -p "require('./package.json').version")" | |
| git push origin main | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Install dependencies (including devDependencies) | |
| - name: Install dependencies | |
| run: npm install | |
| # Publish to npm | |
| - name: Publish to npm | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |