|
| 1 | +jobs: |
| 2 | + pipeline: |
| 3 | + name: publish |
| 4 | + runs-on: ubuntu-latest |
| 5 | + steps: |
| 6 | + - uses: actions/checkout@v4 |
| 7 | + - name: Setup git |
| 8 | + run: |- |
| 9 | + git config --local user.email github_bot@users.noreply.github.com |
| 10 | + git config --local user.name GithubBot |
| 11 | + - name: Setup node |
| 12 | + uses: actions/setup-node@v3 |
| 13 | + with: |
| 14 | + node-version: 22.16.0 |
| 15 | + - name: Setup pnpm |
| 16 | + uses: pnpm/action-setup@v2 |
| 17 | + with: |
| 18 | + version: 10.11.1 |
| 19 | + - name: Setup pnpm cache |
| 20 | + uses: actions/cache@v3 |
| 21 | + with: |
| 22 | + path: node_modules |
| 23 | + key: pnpm-cache-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} |
| 24 | + - name: Install deps |
| 25 | + env: |
| 26 | + HUSKY: 0 |
| 27 | + SKIP_INSTALL_SIMPLE_GIT_HOOKS: 1 |
| 28 | + SKIP_SIMPLE_GIT_HOOKS: 1 |
| 29 | + run: pnpm install --frozen-lockfile |
| 30 | + - name: Bump version and push tag |
| 31 | + id: tag_version |
| 32 | + uses: mathieudutour/github-tag-action@v6.2 |
| 33 | + with: |
| 34 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + - name: Updated npm version and create commit |
| 36 | + run: |- |
| 37 | + npm pkg set version=${{ steps.tag_version.outputs.new_version }} |
| 38 | + git add -A |
| 39 | + git commit -m "chore: published tag ${{steps.tag_version.outputs.new_tag}}" |
| 40 | + - name: Run build |
| 41 | + env: |
| 42 | + NODE_ENV: production |
| 43 | + run: | |
| 44 | + pnpm build |
| 45 | + - name: Create a GitHub release |
| 46 | + uses: ncipollo/release-action@v1 |
| 47 | + with: |
| 48 | + tag: ${{ steps.tag_version.outputs.new_tag }} |
| 49 | + name: Release ${{ steps.tag_version.outputs.new_tag }} |
| 50 | + body: ${{ steps.tag_version.outputs.changelog }} |
| 51 | + - name: Publish library to npm |
| 52 | + uses: JS-DevTools/npm-publish@v3 |
| 53 | + with: |
| 54 | + token: ${{ secrets.NPM_AUTH_TOKEN }} |
| 55 | + - name: Push changes |
| 56 | + uses: ad-m/github-push-action@master |
| 57 | + with: |
| 58 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + branch: ${{ github.ref }} |
| 60 | +name: publish |
| 61 | +on: |
| 62 | + push: |
| 63 | + branches: |
| 64 | + - master |
| 65 | +permissions: |
| 66 | + contents: write |
| 67 | + id-token: write |
0 commit comments