Deploy to NPM #220
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: Deploy to NPM | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 12 * * MON' | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-24.04 | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/[email protected] | |
| with: | |
| fetch-depth: '0' | |
| persist-credentials: false | |
| - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
| - name: Git Identity | |
| run: | | |
| git config --global user.name 'scaleway-bot' | |
| git config --global user.email '[email protected]' | |
| git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
| - uses: pnpm/[email protected] | |
| - name: Use Node.js | |
| uses: actions/[email protected] | |
| with: | |
| registry-url: 'https://registry.npmjs.org/' | |
| node-version: 20 | |
| check-latest: true | |
| - run: pnpm install | |
| - run: pnpm run build | |
| - name: Version package with lerna | |
| run: pnpm lerna version -y --no-private --force-git-tag --create-release github | |
| env: | |
| HUSKY: 0 | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| # https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-nodejs-packages#publishing-packages-to-the-npm-registry | |
| - name: Publish to npm | |
| run: pnpm -r publish --access public --tag latest | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |