diff --git a/.github/workflows/add-issues-to-project.yml b/.github/workflows/add-issues-to-project.yml deleted file mode 100644 index 2b09928df..000000000 --- a/.github/workflows/add-issues-to-project.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Add new issues to the Bento project - -on: - issues: - types: - - opened - -jobs: - add-to-project: - name: Add issue to project - runs-on: ubuntu-latest - steps: - - uses: actions/add-to-project@v0.5.0 - with: - # You can target a repository in a different organization - # to the issue - project-url: https://github.com/orgs/buildo/projects/33 - github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} diff --git a/.github/workflows/cloudflare-pages.yml b/.github/workflows/ci.yml similarity index 58% rename from .github/workflows/cloudflare-pages.yml rename to .github/workflows/ci.yml index e4030a88d..5485db341 100644 --- a/.github/workflows/cloudflare-pages.yml +++ b/.github/workflows/ci.yml @@ -1,19 +1,56 @@ -on: [push] +name: CI -name: Publish Website and Playroom +on: [push] jobs: - publish: + checks: + runs-on: ubuntu-latest + name: Checks + strategy: + fail-fast: false + matrix: + tasks: [prettier-check, eslint-check, check-circular-deps, test, typecheck, build] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 20 + - uses: pnpm/action-setup@v2 + with: + run_install: true + - run: pnpm ${{ matrix.tasks }} + + chromatic: + runs-on: ubuntu-latest + name: Chromatic + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-node@v3 + with: + node-version: 20 + - uses: pnpm/action-setup@v2 + with: + run_install: true + - uses: chromaui/action@v1 + with: + projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} + workingDir: packages/bento-design-system + autoAcceptChanges: main + exitOnceUploaded: true + + cloudflare-pages: runs-on: ubuntu-latest + name: Cloudflare Pages permissions: contents: read deployments: write - name: Cloudflare Pages steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 20 - uses: pnpm/action-setup@v2 with: run_install: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..347d5333b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,68 @@ +name: Release + +on: + push: + tags: ["v*"] + +permissions: write-all + +jobs: + checks: + runs-on: ubuntu-latest + name: Checks + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: pnpm/action-setup@v3 + with: + run_install: true + - run: | + cd packages/bento-design-system + pnpm version --no-git-tag-version --new-version ${{ github.ref_name }} + + - name: Commit & Push changes + uses: actions-js/push@master + with: + message: ${{ github.ref_name }} + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish to npm + uses: JS-DevTools/npm-publish@v3 + with: + package: "packages/bento-design-system/package.json" + token: ${{ secrets.NPM_TOKEN }} + access: "public" + provenance: true + + - name: Publish to Github + uses: JS-DevTools/npm-publish@v3 + with: + package: "packages/bento-design-system/package.json" + registry: "https://npm.pkg.github.com" + token: ${{ secrets.GITHUB_TOKEN }} + access: "public" + provenance: true + + - uses: slackapi/slack-github-action@v1.24.0 + if: ${{ job.status == 'success' }} + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + JOB_STATUS: ${{ job.status }} + ATTACHMENT_COLOR: "good" + with: + channel-id: bento + slack-message: ":tada: Version ${{ github.ref_name }} has been released!" + + - uses: slackapi/slack-github-action@v1.24.0 + if: ${{ job.status == 'failure' }} + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + JOB_STATUS: ${{ job.status }} + ATTACHMENT_COLOR: "danger" + with: + channel-id: bento + slack-message: ":x: Version ${{ github.ref_name }} failed to release" diff --git a/ci/pipeline.yml b/ci/pipeline.yml deleted file mode 100644 index 507a4f1d0..000000000 --- a/ci/pipeline.yml +++ /dev/null @@ -1,216 +0,0 @@ -resource_types: - - name: slack-notification - type: docker-image - source: - repository: cfcommunity/slack-notification-resource - - - name: pull-request - type: docker-image - source: - repository: buildo/github-pr-resource - tag: omitapprovals - -resources: - - name: bento - type: git - icon: github - webhook_token: 0gd4XZNL4Y94zYDLql3C - check_every: 30m - source: - uri: git@github.com:buildo/bento-design-system.git - branch: main - private_key: ((private-key)) - - - name: pr - type: pull-request - icon: github - webhook_token: 0gd4XZNL4Y94zYDLql3C - check_every: 30m - source: - repository: buildo/bento-design-system - access_token: ((github-token)) - omit_approvals: true - - - name: slack-buildo - type: slack-notification - source: - url: ((buildo-slack-hook)) - icon: slack - - - name: release - type: git - icon: github - webhook_token: 0gd4XZNL4Y94zYDLql3C - check_every: 24h - source: - uri: git@github.com:buildo/bento-design-system - branch: main - tag_filter: v* - private_key: ((private-key)) - -jobs: - - name: update-pipeline - plan: - - get: bento - trigger: true - - set_pipeline: self - file: bento/ci/pipeline.yml - - name: main - plan: - - get: bento - trigger: true - - do: - - task: install - file: bento/ci/tasks/install.yml - - in_parallel: - - task: typecheck - file: bento/ci/tasks/typecheck.yml - - task: prettier - file: bento/ci/tasks/prettier.yml - - task: eslint - file: bento/ci/tasks/eslint.yml - - task: test - file: bento/ci/tasks/test.yml - - task: build - file: bento/ci/tasks/build.yml - - task: circular-deps - file: bento/ci/tasks/circular-deps.yml - - task: chromatic - file: bento/ci/tasks/chromatic.yml - params: - CHROMATIC_OPTIONS: --auto-accept-changes - on_failure: - put: slack-buildo - params: - channel: "#bento" - text: | - The build of $BUILD_JOB_NAME failed :cry: - See: $ATC_EXTERNAL_URL/builds/$BUILD_ID - - - name: pr - public: true - plan: - - get: bento - resource: pr - trigger: true - version: every - - in_parallel: - - put: update-status - resource: pr - params: { path: bento, status: pending, context: typecheck } - get_params: { skip_download: true } - - put: update-status - resource: pr - params: { path: bento, status: pending, context: prettier } - get_params: { skip_download: true } - - put: update-status - resource: pr - params: { path: bento, status: pending, context: eslint } - get_params: { skip_download: true } - - put: update-status - resource: pr - params: { path: bento, status: pending, context: test } - get_params: { skip_download: true } - - put: update-status - resource: pr - params: { path: bento, status: pending, context: build } - get_params: { skip_download: true } - - do: - - task: install - file: bento/ci/tasks/install.yml - - in_parallel: - - task: typecheck - file: bento/ci/tasks/typecheck.yml - on_success: - put: update-status - resource: pr - params: { path: bento, status: success, context: typecheck } - get_params: { skip_download: true } - on_failure: - put: update-status - resource: pr - params: { path: bento, status: failure, context: typecheck } - get_params: { skip_download: true } - - - task: prettier - file: bento/ci/tasks/prettier.yml - on_success: - put: update-status - resource: pr - params: { path: bento, status: success, context: prettier } - get_params: { skip_download: true } - on_failure: - put: update-status - resource: pr - params: { path: bento, status: failure, context: prettier } - get_params: { skip_download: true } - - - task: eslint - file: bento/ci/tasks/eslint.yml - on_success: - put: update-status - resource: pr - params: { path: bento, status: success, context: eslint } - get_params: { skip_download: true } - on_failure: - put: update-status - resource: pr - params: { path: bento, status: failure, context: eslint } - get_params: { skip_download: true } - - - task: test - file: bento/ci/tasks/test.yml - on_success: - put: update-status - resource: pr - params: { path: bento, status: success, context: test } - get_params: { skip_download: true } - on_failure: - put: update-status - resource: pr - params: { path: bento, status: failure, context: test } - get_params: { skip_download: true } - - - task: build - file: bento/ci/tasks/build.yml - on_success: - put: update-status - resource: pr - params: { path: bento, status: success, context: build } - get_params: { skip_download: true } - on_failure: - put: update-status - resource: pr - params: { path: bento, status: failure, context: build } - get_params: { skip_download: true } - - - task: circular-deps - file: bento/ci/tasks/circular-deps.yml - on_success: - put: update-status - resource: pr - params: { path: bento, status: success, context: circular-deps } - get_params: { skip_download: true } - on_failure: - put: update-status - resource: pr - params: { path: bento, status: failure, context: circular-deps } - get_params: { skip_download: true } - - - task: chromatic - file: bento/ci/tasks/chromatic.yml - - - name: release - plan: - - get: bento - resource: release - trigger: true - - task: release - file: bento/ci/tasks/release.yml - on_success: - put: slack-buildo - params: - channel: "#bento" - text_file: bento/.git/ref - text: | - :tada: Version $TEXT_FILE_CONTENT has been released! diff --git a/ci/tasks/build.yml b/ci/tasks/build.yml deleted file mode 100644 index 44784c994..000000000 --- a/ci/tasks/build.yml +++ /dev/null @@ -1,26 +0,0 @@ -platform: linux - -image_resource: - type: docker-image - source: - repository: node - tag: "lts-alpine" - -inputs: - - name: bento - -outputs: - - name: bento - -params: - NODE_OPTIONS: --max-old-space-size=4096 - COREPACK_ENABLE_DOWNLOAD_PROMPT: "0" - -run: - dir: bento - path: ash - args: - - -ce - - | - corepack enable - pnpm build diff --git a/ci/tasks/chromatic.yml b/ci/tasks/chromatic.yml deleted file mode 100644 index 3b58d27f6..000000000 --- a/ci/tasks/chromatic.yml +++ /dev/null @@ -1,36 +0,0 @@ -platform: linux - -image_resource: - type: docker-image - source: - repository: node - tag: "lts-alpine" - -inputs: - - name: bento - -params: - CHROMATIC_PROJECT_TOKEN: ((chromatic-project-token)) - CHROMATIC_OPTIONS: - COREPACK_ENABLE_DOWNLOAD_PROMPT: "0" - -run: - dir: bento - path: ash - args: - - -ce - - | - corepack enable - - apk add --no-progress git - - # The pull request resource works by rebasing the PR branch on top of the target branch, which - # will confuse Chromatic. We fix this by manually setting the metadata stored by the resource. - # This is only needed on PRs, hence the check below. - if [ -f .git/resource/head_sha ] && [ -f .git/resource/head_name ]; then - export CHROMATIC_BRANCH=$(cat .git/resource/head_name) - export CHROMATIC_SHA=$(cat .git/resource/head_sha) - fi - - CHROMATIC_OPTIONS="--ci --exit-zero-on-changes --exit-once-uploaded ${CHROMATIC_OPTIONS}" - pnpm chromatic diff --git a/ci/tasks/circular-deps.yml b/ci/tasks/circular-deps.yml deleted file mode 100644 index cbe392c21..000000000 --- a/ci/tasks/circular-deps.yml +++ /dev/null @@ -1,22 +0,0 @@ -platform: linux - -image_resource: - type: docker-image - source: - repository: node - tag: "lts-alpine" - -inputs: - - name: bento - -params: - COREPACK_ENABLE_DOWNLOAD_PROMPT: "0" - -run: - dir: bento - path: ash - args: - - -ce - - | - corepack enable - pnpm check-circular-deps diff --git a/ci/tasks/eslint.yml b/ci/tasks/eslint.yml deleted file mode 100644 index df9404eaf..000000000 --- a/ci/tasks/eslint.yml +++ /dev/null @@ -1,22 +0,0 @@ -platform: linux - -image_resource: - type: docker-image - source: - repository: node - tag: "lts-alpine" - -inputs: - - name: bento - -params: - COREPACK_ENABLE_DOWNLOAD_PROMPT: "0" - -run: - dir: bento - path: ash - args: - - -ce - - | - corepack enable - pnpm eslint-check diff --git a/ci/tasks/install.yml b/ci/tasks/install.yml deleted file mode 100644 index c64602829..000000000 --- a/ci/tasks/install.yml +++ /dev/null @@ -1,32 +0,0 @@ -platform: linux - -image_resource: - type: docker-image - source: - repository: node - tag: "lts-alpine" - -inputs: - - name: bento - -outputs: - - name: bento - -caches: - - path: bento/.pnpm-store - -params: - COREPACK_ENABLE_DOWNLOAD_PROMPT: "0" - -run: - dir: bento - path: ash - args: - - -ce - - | - GREEN='\033[0;32m' - CLEAR='\033[0m' - - corepack enable - pnpm install - echo -e "${GREEN}project dependencies installed${CLEAR}" diff --git a/ci/tasks/prettier.yml b/ci/tasks/prettier.yml deleted file mode 100644 index 1cfef079a..000000000 --- a/ci/tasks/prettier.yml +++ /dev/null @@ -1,22 +0,0 @@ -platform: linux - -image_resource: - type: docker-image - source: - repository: node - tag: "lts-alpine" - -inputs: - - name: bento - -params: - COREPACK_ENABLE_DOWNLOAD_PROMPT: "0" - -run: - dir: bento - path: ash - args: - - -ce - - | - corepack enable - pnpm prettier-check diff --git a/ci/tasks/release.sh b/ci/tasks/release.sh deleted file mode 100755 index 4ae184246..000000000 --- a/ci/tasks/release.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -set -e - -LATEST_TAG=$(git describe --tags) -VERSION=${LATEST_TAG#v} - - -mkdir -p $HOME/.ssh -ssh-keyscan github.com >> $HOME/.ssh/known_hosts -echo "$SSH_PRIVATE_KEY" > $HOME/.ssh/id_rsa -chmod 400 $HOME/.ssh/id_rsa - -git config --global user.email "nemobot@buildo.io" -git config --global user.name "Nemobot" - -corepack enable - -pnpm install -cd packages/bento-design-system -pnpm version --no-git-tag-version --new-version $VERSION - -git add . -git commit -m "v$VERSION" -git push origin HEAD:main - -echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> $HOME/.npmrc -pnpm publish --git-checks false - -pnpm config set '//npm.pkg.github.com/:_authToken' "$GITHUB_TOKEN" -pnpm publish --git-checks false --access public --registry=https://npm.pkg.github.com diff --git a/ci/tasks/release.yml b/ci/tasks/release.yml deleted file mode 100644 index 331c89c72..000000000 --- a/ci/tasks/release.yml +++ /dev/null @@ -1,24 +0,0 @@ -platform: linux - -image_resource: - type: docker-image - source: - repository: node - tag: "18" - -inputs: - - name: bento - -caches: - - path: bento/.pnpm-store - -params: - CI: true - NPM_TOKEN: ((npm_token)) - SSH_PRIVATE_KEY: ((private-key)) - GITHUB_TOKEN: ((github-token)) - COREPACK_ENABLE_DOWNLOAD_PROMPT: "0" - -run: - path: ci/tasks/release.sh - dir: bento diff --git a/ci/tasks/test.yml b/ci/tasks/test.yml deleted file mode 100644 index 04ce2db2d..000000000 --- a/ci/tasks/test.yml +++ /dev/null @@ -1,23 +0,0 @@ -platform: linux - -image_resource: - type: docker-image - source: - repository: node - tag: "lts-alpine" - -inputs: - - name: bento - -params: - CI: true - COREPACK_ENABLE_DOWNLOAD_PROMPT: "0" - -run: - dir: bento - path: ash - args: - - -ce - - | - corepack enable - pnpm test diff --git a/ci/tasks/typecheck.yml b/ci/tasks/typecheck.yml deleted file mode 100644 index aeb06d5e9..000000000 --- a/ci/tasks/typecheck.yml +++ /dev/null @@ -1,22 +0,0 @@ -platform: linux - -image_resource: - type: docker-image - source: - repository: node - tag: "lts-alpine" - -inputs: - - name: bento - -params: - COREPACK_ENABLE_DOWNLOAD_PROMPT: "0" - -run: - dir: bento - path: ash - args: - - -ce - - | - corepack enable - pnpm typecheck diff --git a/packages/bento-design-system/.storybook/main.ts b/packages/bento-design-system/.storybook/main.ts index f5d5c2486..0617f1e33 100644 --- a/packages/bento-design-system/.storybook/main.ts +++ b/packages/bento-design-system/.storybook/main.ts @@ -1,8 +1,7 @@ import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin"; -// @ts-expect-error -import * as path from "path"; import type { StorybookConfig } from "@storybook/react-vite"; import { mergeConfig } from "vite"; +import react from "@vitejs/plugin-react"; const config: StorybookConfig = { stories: [{ directory: "../stories", files: "**/*.stories.*" }], @@ -13,7 +12,7 @@ const config: StorybookConfig = { }, viteFinal: (config) => { return mergeConfig(config, { - plugins: [vanillaExtractPlugin()], + plugins: [react(), vanillaExtractPlugin()], }); }, };