Merge pull request #101 from frouriojs/develop #231
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: Test Build and Publish | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
cache-pnpm: | |
name: Cache Pnpm | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.pnpm-store | |
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}- | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 9 | |
run_install: | | |
- recursive: true | |
args: [--frozen-lockfile, --prefer-offline] | |
test-build-publish: | |
name: Test Build and Publish | |
needs: cache-pnpm | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 20 | |
- name: Cache pnpm modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/.pnpm-store | |
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}- | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 9 | |
run_install: | | |
- recursive: true | |
args: [--frozen-lockfile, --prefer-offline] | |
- name: Run lint | |
run: pnpm lint | |
- name: Run typecheck | |
run: pnpm typecheck | |
- name: Run test | |
run: pnpm test | |
- name: Build | |
run: pnpm build | |
- if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }} | |
name: Configure npm token | |
run: pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }} | |
- name: Publish Dry Run | |
run: pnpm -r publish --no-git-checks --dry-run | |
- if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }} | |
name: Publish if needed | |
run: pnpm -r publish --access public |