fix: upgrade @storybook/test-runner from 0.10.0 to 0.19.1 #203
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: GitHub Workflows (Lint, Test, Build) Actions | |
# run workflow manually or during PR | |
on: | |
push: | |
tags: | |
- '!**' | |
branches: | |
- '**' | |
# Allow one concurrent deployment | |
# concurrency: | |
# group: ${{ github.ref }} | |
# cancel-in-progress: true | |
jobs: | |
################################## INSTALL-DEP ######################################### | |
install-dependencies: | |
runs-on: ubuntu-latest | |
name: Install dependencies | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Step Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install | |
- name: zip node_modules | |
run: tar -czf node_modules.tar.gz ./node_modules | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: my_node_modules_artifact | |
path: node_modules.tar.gz | |
################################## LINT ######################################### | |
lint: | |
needs: [install-dependencies] | |
runs-on: ubuntu-latest | |
name: Lint and check TS | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Step Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: pnpm | |
- name: Load artifact node_modules | |
uses: actions/download-artifact@v3 | |
with: | |
name: my_node_modules_artifact | |
- name: unzip node_modules | |
run: tar -xzf node_modules.tar.gz | |
- name: Lint and ts check | |
run: | | |
pnpm ts:check | |
pnpm lint | |
# - name: Dependency validation | |
# run: pnpm dependency:validation | |
###################################### BUILD ##################################### | |
build: | |
needs: [install-dependencies] | |
runs-on: ubuntu-latest | |
name: Build | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Step Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: pnpm | |
- name: Load artifact node_modules | |
uses: actions/download-artifact@v3 | |
with: | |
name: my_node_modules_artifact | |
- name: unzip node_modules | |
run: tar -xzf node_modules.tar.gz | |
- name: Build Storybook | |
run: pnpm build | |
- name: Build Rollup Storybook | |
run: pnpm build:rollup | |
- name: zip storybook-static | |
run: tar -czf storybook-static.tar.gz ./storybook-static | |
- name: Upload storybook-static artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: my_storybook-static_artifact | |
path: storybook-static.tar.gz | |
- name: zip dist | |
run: tar -czf dist.tar.gz ./dist | |
- name: Upload dist artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: my_dist_artifact | |
path: dist.tar.gz | |
################################## TEST ######################################### | |
test: | |
needs: [build] | |
environment: | |
name: Development | |
runs-on: ubuntu-latest | |
name: Test | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Step Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: pnpm | |
- name: Load artifact node_modules | |
uses: actions/download-artifact@v3 | |
with: | |
name: my_node_modules_artifact | |
- name: unzip node_modules | |
run: tar -xzf node_modules.tar.gz | |
- name: Load artifact storybook-static | |
uses: actions/download-artifact@v3 | |
with: | |
name: my_storybook-static_artifact | |
- name: unzip storybook-static | |
run: tar -xzf storybook-static.tar.gz | |
- name: Install Playwright | |
run: pnpm dlx playwright install --with-deps | |
- name: Test CI | |
run: pnpm test-coverage:ci | |
- name: zip coverage | |
run: tar -czf coverage.tar.gz ./coverage | |
- name: Upload artifact coverage | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage_artifact | |
path: coverage.tar.gz | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: ./coverage/storybook | |
fail_ci_if_error: true | |
files: ./coverage/storybook/coverage-storybook.json | |
verbose: true | |
################################## RELEASE ######################################### | |
release: | |
needs: [ test ] | |
name: "Release GitHub" | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Step Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: pnpm | |
- name: Load artifact node_modules | |
uses: actions/download-artifact@v3 | |
with: | |
name: my_node_modules_artifact | |
- name: Unzip node_modules | |
run: tar -xzf node_modules.tar.gz | |
- name: Get package version | |
id: get-version | |
run: | | |
version=v$(pnpm pkg get version | tr -d '"') | |
echo "version=$version" >> $GITHUB_OUTPUT | |
echo "====> $version" | |
shell: bash | |
- name: "Create Tag ${{ steps.get-version.outputs.version }}" | |
uses: rickstaa/action-create-tag@v1 | |
id: create-tag | |
with: | |
tag: ${{ steps.get-version.outputs.version }} | |
tag_exists_error: false | |
message: ${{ steps.get-version.outputs.version }} | |
- run: | | |
echo "Tag already present: ${{ steps.create-tag.outputs.tag_exists }}" | |
- name: Extract release notes from CHANGELOG.md | |
id: extract-release-notes | |
uses: ffurrer2/extract-release-notes@v1 | |
with: | |
changelog_file: CHANGELOG.md | |
- name: "Create a GitHub release ${{ steps.get-version.outputs.version }}" | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: "${{ steps.get-version.outputs.version }}" | |
name: "Release ${{ steps.get-version.outputs.version }}" | |
body: | | |
## Release notes: | |
${{ steps.extract-release-notes.outputs.release_notes }} | |
################################## DEPLOYMENT ######################################## | |
publish-npm: | |
needs: [release] | |
name: "Publish to NPM" | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
environment: | |
name: Production | |
env: | |
NPM_TOKEN: ${{secrets.NPM_TOKEN}} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # 👈 Required to retrieve git history | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Step Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: pnpm | |
- name: Load artifact node_modules | |
uses: actions/download-artifact@v3 | |
with: | |
name: my_node_modules_artifact | |
- name: unzip node_modules | |
run: tar -xzf node_modules.tar.gz | |
- name: Load artifact dist | |
uses: actions/download-artifact@v3 | |
with: | |
name: my_dist_artifact | |
- name: unzip dist | |
run: tar -xzf dist.tar.gz | |
- name: Set deployment token | |
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" | |
- name: Publish to NPM | |
run: pnpm publish --access=public --no-git-checks | |
publish-chromatic: | |
needs: [release] | |
name: "Publish to Chromatic" | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
environment: | |
name: Production | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # 👈 Required to retrieve git history | |
- name: Load artifact storybook-static | |
uses: actions/download-artifact@v3 | |
with: | |
name: my_storybook-static_artifact | |
- name: unzip storybook-static | |
run: tar -xzf storybook-static.tar.gz | |
- name: Publish to Chromatic | |
id: chromatic | |
uses: chromaui/action@v1 | |
with: | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
storybookBuildDir: 'storybook-static' | |
- name: Publish Chromatic Summary | |
run: echo -e "| Results | |\n| --- | --- |\n| Build Results | ${{steps.chromatic.outputs.buildUrl}} |\n| Storybook Preview | ${{steps.chromatic.outputs.storybookUrl}} |\n| Component Count | ${{steps.chromatic.outputs.componentCount}} |" >> $GITHUB_STEP_SUMMARY |