diff --git a/.github/workflows/ci-templates.yml b/.github/workflows/ci-templates.yml index fa08bf7643..8cb8ed6414 100644 --- a/.github/workflows/ci-templates.yml +++ b/.github/workflows/ci-templates.yml @@ -14,6 +14,10 @@ on: paths: - 'templates/**' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: name: build @@ -21,7 +25,6 @@ jobs: strategy: fail-fast: false matrix: - node-version: [18.18.x] template: - plate-template - plate-playground-template @@ -37,27 +40,23 @@ jobs: version: 8.6.1 run_install: false - - name: Use Node.js ${{ matrix.node-version }} + - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 22 cache: 'pnpm' cache-dependency-path: '**/pnpm-lock.yaml' - - name: Get pnpm store directory - id: pnpm-cache - run: | - echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT - - uses: actions/cache@v4 - name: โ™ป๏ธ Setup pnpm cache + - name: Setup pnpm cache + uses: actions/cache@v4 with: - path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + path: $(pnpm store path) + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | - ${{ runner.os }}-pnpm-store- + ${{ runner.os }}-pnpm- - - name: ๐Ÿ“ฅ Install + - name: ๐Ÿ“ฅ Install dependencies run: pnpm install --no-frozen-lockfile - - name: ๐Ÿ— Run build + - name: ๐Ÿ— Build run: pnpm build diff --git a/.github/workflows/clean-up-pr-caches.yml b/.github/workflows/clean-up-pr-caches.yml index 760963766f..ba3e352a0e 100644 --- a/.github/workflows/clean-up-pr-caches.yml +++ b/.github/workflows/clean-up-pr-caches.yml @@ -13,23 +13,30 @@ jobs: - name: Check out code uses: actions/checkout@v4 - - name: ๐Ÿงน Cleanup + - name: ๐Ÿงน Cleanup caches + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge run: | + # Install GitHub CLI cache extension gh extension install actions/gh-actions-cache - REPO=${{ github.repository }} - BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" - - echo "Fetching list of cache key" - cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) + echo "Fetching list of cache keys..." + cacheKeys=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1) - ## Setting this to not fail the workflow while deleting cache keys. + # Continue even if some cache deletions fail set +e + + if [ -z "$cacheKeys" ]; then + echo "No caches found to delete" + exit 0 + fi + echo "Deleting caches..." - for cacheKey in $cacheKeysForPR - do - gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm + for cacheKey in $cacheKeys; do + echo "Deleting cache: $cacheKey" + gh actions-cache delete "$cacheKey" -R $REPO -B $BRANCH --confirm done - echo "Done" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + echo "Cache cleanup completed" diff --git a/.github/workflows/lint-typecheck.yml b/.github/workflows/lint-typecheck.yml index e65c0112bf..e51e84b1b4 100644 --- a/.github/workflows/lint-typecheck.yml +++ b/.github/workflows/lint-typecheck.yml @@ -39,21 +39,23 @@ on: - 'scripts' - 'patches' +# Add concurrency to cancel redundant runs +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: lint-typecheck: - name: ${{ matrix.command }} + name: Lint and Typecheck runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.18.x] steps: - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 22 - name: ๐Ÿ“ฅ Monorepo install uses: ./.github/actions/yarn-nm-install @@ -66,24 +68,23 @@ jobs: ${{ github.workspace }}/**/tsconfig.tsbuildinfo key: packages-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }} - - name: ๐Ÿ— Run build + - name: ๐Ÿ— Build run: yarn build - - name: ๐Ÿ”ฌ Linter + - name: ๐Ÿ”ฌ Lint run: yarn lint - name: ๐Ÿ•ต๏ธ Typecheck run: yarn typecheck:all - notify-lint-typecheck-failure: + notify-failure: name: Discord Notification runs-on: ubuntu-latest - needs: - - lint-typecheck + needs: [lint-typecheck] if: ${{ github.event_name == 'push' && failure() }} steps: - - name: Notify + - name: Send Discord Notification uses: nobrayner/discord-webhook@v1 with: github-token: ${{ secrets.X_GITHUB_READ_ACTIONS_TOKEN }} diff --git a/.github/workflows/notify-release.yml b/.github/workflows/notify-release.yml index f515a0784e..fba44c0a76 100644 --- a/.github/workflows/notify-release.yml +++ b/.github/workflows/notify-release.yml @@ -9,12 +9,13 @@ jobs: name: Discord Notification runs-on: ubuntu-latest if: ${{ startsWith(github.ref, 'refs/tags/@udecode/plate@') }} + steps: - - name: get-version + - name: Extract Version id: version run: echo "output=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - - name: notify + - name: Send Discord Notification uses: sebastianpopp/discord-action@releases/v2 with: webhook: ${{ secrets.DISCORD_RELEASE_WEBHOOK }} diff --git a/.github/workflows/registry.yml b/.github/workflows/registry.yml index fe79a578f3..bc96ec5f75 100644 --- a/.github/workflows/registry.yml +++ b/.github/workflows/registry.yml @@ -13,17 +13,18 @@ jobs: update-registry: name: Update Registry runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.18.x] + + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true steps: - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 22 - name: ๐Ÿ“ฅ Monorepo install uses: ./.github/actions/yarn-nm-install @@ -49,3 +50,5 @@ jobs: committer: GitHub branch: registry delete-branch: true + add-paths: | + apps/www/**/* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ddd9111711..081957b73b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,39 +6,34 @@ on: jobs: release: - # Basic security: the release job can only be executed from this repo and from the main branch (not a remote thing) - if: ${{ github.repository == 'udecode/plate' && contains('refs/heads/main',github.ref)}} name: Release and changelog runs-on: ubuntu-latest + # Basic security: the release job can only be executed from this repo and from the main branch + if: ${{ github.repository == 'udecode/plate' && contains('refs/heads/main',github.ref)}} + steps: - - name: Checkout Repo + - name: ๐Ÿ“ฅ Checkout Repo uses: actions/checkout@v4 with: - # To run comparison we need more than the latest commit. - # @link https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches + # To run comparison we need more than the latest commit fetch-depth: 0 - - name: โ™ป๏ธ Use Node.js 18.x + - name: โ™ป๏ธ Setup Node.js uses: actions/setup-node@v4 with: - node-version: 18.18.x + node-version: 22 - - name: ๐Ÿ“ฅ Monorepo install + - name: ๐Ÿ“ฆ Monorepo install uses: ./.github/actions/yarn-nm-install # @link https://github.com/changesets/action - - name: ๐Ÿฆ‹ Create Release Pull Request or Publish to npm + - name: ๐Ÿฆ‹ Create Release Pull Request or Publish id: changesets uses: changesets/action@v1 with: - # publish: yarn g:release cwd: ${{ github.workspace }} title: '[Release] Version packages' publish: yarn release - # Optional, might be used in conjunction with GITHUB_TOKEN to - # allow running the workflows on a Version package action. - # Be aware of security implications. - # setupGitUser: true env: # See https://github.com/changesets/action/issues/147 HOME: ${{ github.workspace }} diff --git a/.github/workflows/sync-templates.yml b/.github/workflows/sync-templates.yml index 8d11772462..dcff73b69e 100644 --- a/.github/workflows/sync-templates.yml +++ b/.github/workflows/sync-templates.yml @@ -12,66 +12,63 @@ on: jobs: build: - name: build + name: Build runs-on: ubuntu-latest strategy: fail-fast: false matrix: - node-version: [18.18.x] template: - plate-template - plate-playground-template defaults: run: working-directory: templates/${{ matrix.template }} + steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2.4.1 - name: Install pnpm + - name: ๐Ÿ“ฆ Install pnpm + uses: pnpm/action-setup@v2.4.1 with: version: 8.6.1 run_install: false - - name: Use Node.js ${{ matrix.node-version }} + - name: โ™ป๏ธ Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 22 cache: 'pnpm' cache-dependency-path: '**/pnpm-lock.yaml' - - name: Get pnpm store directory - id: pnpm-cache - run: | - echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v4 - name: Setup pnpm cache + - name: ๐Ÿ”„ Setup pnpm cache + uses: actions/cache@v4 with: - path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + path: $(pnpm store path) + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | - ${{ runner.os }}-pnpm-store- + ${{ runner.os }}-pnpm- - name: ๐Ÿ“ฅ Install dependencies run: pnpm install --no-frozen-lockfile - - name: ๐Ÿ— Run build + - name: ๐Ÿ— Build run: pnpm build sync: needs: build runs-on: ubuntu-latest + if: ${{ success() }} strategy: fail-fast: false matrix: template: - plate-template - plate-playground-template - if: ${{ success() }} + steps: - uses: actions/checkout@v4 - - name: Sync Templates + + - name: ๐Ÿ”„ Sync Templates env: API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} run: ./scripts/sync-templates.sh "templates/${{ matrix.template }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4c9902f710..e89b49ae58 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,19 +43,21 @@ on: jobs: test: - name: ${{ matrix.command }} + name: Unit Tests runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.18.x] + + # Add concurrency to cancel redundant runs + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true steps: - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + - name: โ™ป๏ธ Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 22 - name: ๐Ÿ“ฅ Monorepo install uses: ./.github/actions/yarn-nm-install @@ -68,21 +70,20 @@ jobs: ${{ github.workspace }}/**/tsconfig.tsbuildinfo key: packages-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }} - - name: ๐Ÿ— Run build + - name: ๐Ÿ— Build run: yarn build - - name: ๐Ÿงช Unit tests + - name: ๐Ÿงช Run tests run: yarn test notify-test-failure: name: Discord Notification runs-on: ubuntu-latest - needs: - - test + needs: [test] if: ${{ github.event_name == 'push' && failure() }} steps: - - name: Notify + - name: ๐Ÿ”” Send Discord Notification uses: nobrayner/discord-webhook@v1 with: github-token: ${{ secrets.X_GITHUB_READ_ACTIONS_TOKEN }} diff --git a/.nvmrc b/.nvmrc index 5871e601c5..92f279e3e6 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v20.12.1 \ No newline at end of file +v22 \ No newline at end of file