Skip to content

chore: configure pnpm version for corepack #28

chore: configure pnpm version for corepack

chore: configure pnpm version for corepack #28

Workflow file for this run

name: Publish
on:
workflow_run:
workflows: [Lint and test]
types: [completed]
branches: [main]
jobs:
create-release-and-publish:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Create release
uses: googleapis/release-please-action@d1a8f221d7723166f48a584aebba00ef3f6febec # v4.1.4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
target-branch: main
# The logic below handles the npm publication:
- name: Check out branch
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
# This is necessary because on.workflow_run always runs on the
# default branch, which is 'develop' in our case
ref: "main"
# these if statements ensure that a publication only occurs when
# a new release is created:
if: ${{ steps.release.outputs.releases_created == 'true' }}
- name: Set up Node.js version
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version-file: .nvmrc
registry-url: "https://registry.npmjs.org"
if: ${{ steps.release.outputs.releases_created == 'true' }}
- name: Install pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
id: pnpm-install
with:
run_install: false
if: ${{ steps.release.outputs.releases_created == 'true' }}
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
if: ${{ steps.release.outputs.releases_created == 'true' }}
- name: Set up pnpm cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
if: ${{ steps.release.outputs.releases_created == 'true' }}
- name: Install dependencies
run: pnpm install
if: ${{ steps.release.outputs.releases_created == 'true' }}
- name: Build
run: pnpm run build
if: ${{ steps.release.outputs.releases_created == 'true' }}
- name: Publish
run: pnpm -r publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release.outputs.releases_created == 'true' }}
# The logic below handles the Storybook deploy:
- name: "Restore build artifact: Storybook"
uses: dawidd6/action-download-artifact#bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6
with:
workflow: "lint-test.yml"
name: storybook
path: dist/storybook
if: ${{ steps.release.outputs.releases_created == 'true' }}
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@94f3c658273cf92fb48ef99e5fbc02bd2dc642b2 # v4.6.3
with:
branch: gh-pages
folder: dist/storybook
# feature branch directories are prefixed with demo-*
# these are excluded from this action's default clean
clean-exclude: demo-*
if: ${{ steps.release.outputs.releases_created == 'true' }}