Workflow file for this run
This file contains hidden or 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: Publish Package & Deploy Storybook | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| packages: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Install pnpm | |
| run: corepack prepare pnpm@latest --activate | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| registry-url: 'https://npm.pkg.github.com' | |
| scope: '@lastro-co' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Set version from release tag | |
| run: | | |
| VERSION="${{ github.event.release.tag_name }}" | |
| VERSION="${VERSION#v}" | |
| npm version "$VERSION" --no-git-tag-version | |
| - name: Build package | |
| run: pnpm run build | |
| - name: Publish package | |
| run: pnpm publish --no-git-checks | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| storybook-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Install pnpm | |
| run: corepack prepare pnpm@latest --activate | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run tests with coverage | |
| run: pnpm run test | |
| - name: Generate coverage badge | |
| run: | | |
| COVERAGE=$(node -e "const r = require('./coverage/coverage-summary.json'); console.log(r.total.statements.pct)") | |
| if (( $(echo "$COVERAGE >= 90" | bc -l) )); then COLOR="brightgreen" | |
| elif (( $(echo "$COVERAGE >= 80" | bc -l) )); then COLOR="green" | |
| elif (( $(echo "$COVERAGE >= 70" | bc -l) )); then COLOR="yellowgreen" | |
| elif (( $(echo "$COVERAGE >= 60" | bc -l) )); then COLOR="yellow" | |
| else COLOR="red"; fi | |
| echo "{\"schemaVersion\":1,\"label\":\"coverage\",\"message\":\"${COVERAGE}%\",\"color\":\"${COLOR}\"}" > coverage-badge.json | |
| - name: Build Storybook | |
| run: pnpm run build-storybook | |
| - name: Add coverage badge to Storybook | |
| run: cp coverage-badge.json storybook-static/coverage-badge.json | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: storybook-static | |
| storybook-deploy: | |
| needs: storybook-build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@v4 |