Skip to content

docs: update readme (#141) #21

docs: update readme (#141)

docs: update readme (#141) #21

name: build-test-publish-on-push-cached
on:
workflow_dispatch:
push:
branches:
- 'main'
- 'next'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: 8
- run: pnpm add -g pnpm
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'
- run: pnpm install
- run: pnpm build
- name: 'Save build output'
uses: actions/cache/save@v3
with:
path: ${{ github.workspace }}
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}
publish:
needs:
- build
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{secrets.GITHUB_TOKEN}}
- uses: pnpm/action-setup@v2
with:
version: 8
- run: pnpm add -g pnpm
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'
- name: 'Restore build output'
uses: actions/cache/restore@v3
with:
path: ${{ github.workspace }}
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}
restore-keys: ${{ runner.os }}-build-${{ github.sha }}
fail-on-cache-miss: true
- name: 'Setup git coordinates'
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
- name: 'Setup npm registry'
run: |
echo "@vckit:registry=https://registry.npmjs.org/" > .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
npm whoami
- name: 'Publish @latest when on main'
if: github.ref == 'refs/heads/main'
run: pnpm publish:latest
- name: 'Publish @next when on next'
if: github.ref == 'refs/heads/next'
run: pnpm publish:next