Update readme.md #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 CLI Prerelease | |
| on: | |
| pull_request: | |
| types: | |
| - closed | |
| branches: | |
| - main | |
| jobs: | |
| if_merged: | |
| if: github.event.pull_request.merged | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| token: ${{secrets.PAT}} | |
| - name: Enable Corepack before setting up Node | |
| run: corepack enable | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20.x" | |
| - name: Authenticate to npm | |
| run: | | |
| echo "registry=https://registry.npmjs.org/" >> .npmrc | |
| echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc | |
| npm whoami | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Install dependencies | |
| run: yarn install --immutable | |
| - name: Build | |
| run: yarn build | |
| - name: Run tests | |
| run: yarn test | |
| - name: Version | |
| run: | | |
| git config user.name "${{ github.actor }}" | |
| git config user.email "${{ github.actor }}@users.noreply.github.com" | |
| yarn version --prerelease --preid alpha --message "chore(release): %s [skip ci]" | |
| - name: Publish to npm | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| yarn publish --tag alpha --access public | |
| - name: Update npm for GitHub Packages | |
| run: | | |
| rm -rf .npmrc | |
| echo "registry=https://npm.pkg.github.com/" >> .npmrc | |
| echo "//npm.pkg.github.com/:_authToken=$NPM_TOKEN" >> .npmrc | |
| env: | |
| NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to GitHub Packages | |
| run: yarn publish --tag alpha --access public --registry https://npm.pkg.github.com/ |