ci: fix publish access #31
This file contains 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: CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
tags: | |
- "v*.*.*" | |
jobs: | |
eslint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3.0.0 | |
with: | |
version: 8 | |
- name: Install | |
run: pnpm install --no-frozen-lockfile | |
- name: Lint | |
run: pnpm run lint | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3.0.0 | |
with: | |
version: 8 | |
- name: Install packages | |
run: pnpm install --no-frozen-lockfile | |
- name: Test | |
run: pnpm run test | |
publish: | |
runs-on: ubuntu-latest | |
needs: [eslint, tests] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3.0.0 | |
with: | |
version: 8 | |
- name: Install packages | |
run: pnpm install --no-frozen-lockfile | |
- name: Build | |
run: pnpm run build | |
- name: Generate changelog | |
run: npx changelogithub | |
env: | |
GITHUB_TOKEN: ${{secrets.GH_TOKEN}} | |
- name: Publish package | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
access: public |