From 560cb13c2d42591f0102e05abd2bd2f7486bb4e9 Mon Sep 17 00:00:00 2001 From: madinah <497350746@qq.com> Date: Wed, 10 Sep 2025 19:25:23 +0800 Subject: [PATCH] =?UTF-8?q?chore(none):=20=F0=9F=A4=96=20update=20publish?= =?UTF-8?q?=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/config.json | 2 +- .changeset/config.v1.json | 11 ++ .github/workflows/release-changeset.yml | 142 +++++++++++++++++++++ .github/workflows/release-js-plugins.yml | 47 ------- .github/workflows/release-rust-plugins.yml | 57 --------- package.json | 3 + 6 files changed, 157 insertions(+), 105 deletions(-) create mode 100644 .changeset/config.v1.json create mode 100644 .github/workflows/release-changeset.yml delete mode 100644 .github/workflows/release-js-plugins.yml delete mode 100644 .github/workflows/release-rust-plugins.yml diff --git a/.changeset/config.json b/.changeset/config.json index ae82eba8..d4dfac09 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -4,7 +4,7 @@ "commit": false, "fixed": [], "linked": [], - "access": "restricted", + "access": "public", "baseBranch": "main", "updateInternalDependencies": "patch", "ignore": [] diff --git a/.changeset/config.v1.json b/.changeset/config.v1.json new file mode 100644 index 00000000..33c14b46 --- /dev/null +++ b/.changeset/config.v1.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json", + "changelog": "@changesets/cli/changelog", + "commit": false, + "fixed": [], + "linked": [], + "access": "public", + "baseBranch": "v1-main", + "updateInternalDependencies": "patch", + "ignore": [] +} \ No newline at end of file diff --git a/.github/workflows/release-changeset.yml b/.github/workflows/release-changeset.yml new file mode 100644 index 00000000..b9737cc5 --- /dev/null +++ b/.github/workflows/release-changeset.yml @@ -0,0 +1,142 @@ +name: Release with Changeset + +on: + push: + branches: + - main + - v1-main + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + release-js: + name: Release JS Plugins + runs-on: ubuntu-latest + if: contains(github.event.head_commit.message, 'js-plugins') || contains(github.event.head_commit.message, 'all') + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + with: + # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits + fetch-depth: 0 + + - name: Setup Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + + - name: Enable Corepack + run: corepack enable + + - name: Install Dependencies + run: pnpm install --frozen-lockfile + + - name: Build Packages + run: pnpm --filter "{js-plugins}[HEAD~1]" build + + - name: Set npm access config + run: | + echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + npm config set access public + + - name: Create Release Pull Request or Publish to npm (main branch - beta) + if: github.ref == 'refs/heads/main' + id: changesets-main + uses: changesets/action@v1 + with: + publish: pnpm exec changeset publish --tag beta + title: "Release: JS Plugins (Beta)" + commit: "chore: release js plugins (beta)" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Create Release Pull Request or Publish to npm (v1-main branch - stable) + if: github.ref == 'refs/heads/v1-main' + id: changesets-v1 + uses: changesets/action@v1 + with: + publish: pnpm exec changeset publish + title: "Release: JS Plugins (Stable)" + commit: "chore: release js plugins (stable)" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + release-rust: + name: Release Rust Plugins + runs-on: ubuntu-latest + if: contains(github.event.head_commit.message, 'rust-plugins') || contains(github.event.head_commit.message, 'all') + needs: [call-rust-build] + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + + - name: Enable Corepack + run: corepack enable + + # Download artifacts from build job + - uses: actions/download-artifact@v4 + with: + path: /tmp/artifacts + + - name: Move Artifacts + run: | + for abi in linux-x64-gnu linux-x64-musl darwin-x64 win32-x64-msvc linux-arm64-musl linux-arm64-gnu darwin-arm64 win32-ia32-msvc win32-arm64-msvc + do + for package in dsv react-components virtual yaml strip image url icons auto-import mdx wasm worker svgr modular-import compress + do + folder_path="/tmp/artifacts/${{github.sha}}-${abi}-${package}" + if [ -d "${folder_path}" ] && [ -n "$(ls -A $folder_path)" ]; then + mv /tmp/artifacts/${{ github.sha }}-${abi}-${package}/* ./rust-plugins/${package}/npm/${abi} + ls -R $folder_path + ls -R ./rust-plugins/${package}/npm/${abi} + test -f ./rust-plugins/${package}/npm/${abi}/index.farm + else + echo "${folder_path} is empty" + fi + done + done + + - name: Install Dependencies + run: pnpm install --frozen-lockfile + + - name: Set npm access config + run: | + echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + npm config set access public + + - name: Create Release Pull Request or Publish to npm (main branch - beta) + if: github.ref == 'refs/heads/main' + id: changesets-rust-main + uses: changesets/action@v1 + with: + publish: pnpm exec changeset publish --tag beta + title: "Release: Rust Plugins (Beta)" + commit: "chore: release rust plugins (beta)" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Create Release Pull Request or Publish to npm (v1-main branch - stable) + if: github.ref == 'refs/heads/v1-main' + id: changesets-rust-v1 + uses: changesets/action@v1 + with: + publish: pnpm exec changeset publish + title: "Release: Rust Plugins (Stable)" + commit: "chore: release rust plugins (stable)" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + call-rust-build: + if: contains(github.event.head_commit.message, 'rust-plugins') || contains(github.event.head_commit.message, 'all') + uses: ./.github/workflows/build.yaml \ No newline at end of file diff --git a/.github/workflows/release-js-plugins.yml b/.github/workflows/release-js-plugins.yml deleted file mode 100644 index 358bd00c..00000000 --- a/.github/workflows/release-js-plugins.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Release Packages - -on: - push: - branches: - - main - -jobs: - release: - runs-on: ubuntu-latest - if: contains(github.event.head_commit.message, 'js-plugins') || contains(github.event.head_commit.message, 'all') - name: release - steps: - - name: Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - # - run: | - # git fetch --no-tags --prune --depth=1 origin +refs/heads/main:refs/remotes/HEAD~1 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20 - registry-url: https://registry.npmjs.org/ - - - name: Enable Corepack - id: pnpm-setup - run: | - corepack enable - - - name: Initliaze .npmrc - run: > - echo -e "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}\n$(cat .npmrc)" > .npmrc - && cat -n .npmrc - - - name: pnpm install - run: pnpm install --frozen-lockfile - - - name: Build Packages - run: | - pnpm --filter "{js-plugins}[HEAD~1]" build - - - name: Release and Publish Packages - run: | - npm set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} && npm config set access public && pnpm --filter "{js-plugins}[HEAD~1]" publish --no-git-checks diff --git a/.github/workflows/release-rust-plugins.yml b/.github/workflows/release-rust-plugins.yml deleted file mode 100644 index 6c2bf44e..00000000 --- a/.github/workflows/release-rust-plugins.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Publish packages and crates -on: - push: - branches: - - main - -concurrency: ${{ github.workflow }}-${{ github.ref }} - -jobs: - call-rust-build: - if: contains(github.event.head_commit.message, 'rust-plugins') || contains(github.event.head_commit.message, 'all') - uses: ./.github/workflows/build.yaml - - release: - name: Release - if: contains(github.event.head_commit.message, 'rust-plugins') || contains(github.event.head_commit.message, 'all') - needs: [call-rust-build] - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: Setup Node.js 18.x - uses: actions/setup-node@v4 - with: - node-version: 18.x - - # batch download artifacts - - uses: actions/download-artifact@v4 - with: - path: /tmp/artifacts - - name: Move Artifacts - run: | - for abi in linux-x64-gnu linux-x64-musl darwin-x64 win32-x64-msvc linux-arm64-musl linux-arm64-gnu darwin-arm64 win32-ia32-msvc win32-arm64-msvc - do - for package in dsv react-components virtual yaml strip image url icons auto-import mdx wasm worker svgr modular-import compress - do - folder_path="/tmp/artifacts/${{github.sha}}-${abi}-${package}" - if [ -d "${folder_path}" ] && [ -n "$(ls -A $folder_path)" ]; then - mv /tmp/artifacts/${{ github.sha }}-${abi}-${package}/* ./rust-plugins/${package}/npm/${abi} - ls -R $folder_path - ls -R ./rust-plugins/${package}/npm/${abi} - test -f ./rust-plugins/${package}/npm/${abi}/index.farm - else - echo "${folder_path} is empty" - fi - done - done - - - name: Install Dependencies - run: npm install -g pnpm@9.1.0 && pnpm i --frozen-lockfile - - - name: Publish to npm - run: | - npm set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} && npm config set access public && pnpm --filter "{rust-plugins}[HEAD~1]" publish --tag beta --no-git-checks diff --git a/package.json b/package.json index 793f21e5..f405b738 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,9 @@ "packageManager": "pnpm@9.1.0", "scripts": { "release": "npx changeset && npx changeset version", + "changeset": "changeset", + "version-packages": "changeset version", + "release-packages": "changeset publish", "prepare": "husky install", "commit": "git cz" },