Skip to content

Commit

Permalink
ci: remove cnpm sync workflow (#3624)
Browse files Browse the repository at this point in the history
  • Loading branch information
jikkai authored Sep 29, 2024
1 parent 1149cff commit ae2297d
Show file tree
Hide file tree
Showing 51 changed files with 76 additions and 180 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: 📦 Build

on:
push:
branches: [dev]
branches:
- dev
pull_request:
branches: [dev]
branches:
- dev

permissions:
contents: read
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: 🧪 CI Test

on:
push:
branches: [main, dev]
branches:
- dev
pull_request:
branches: [main, dev]
branches:
- dev

permissions:
contents: read
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: 🎭 Playwright Tests

on:
pull_request:
branches: [dev]
branches:
- dev

jobs:
e2e-test:
Expand Down
80 changes: 8 additions & 72 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,56 +70,13 @@ jobs:
- name: 🐙 Publish
run: |
if [[ ${{ needs.prepare.outputs.release_type }} == "alpha" ]]; then
pnpm publish --access public --tag ${{ needs.prepare.outputs.release_type }} -r --no-git-checks
else
if [[ ${{ needs.prepare.outputs.release_type }} == "stable" ]]; then
pnpm publish --access public -r --no-git-checks
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

release-verdaccio:
needs: [prepare]
if: github.repository == 'dream-num/univer'
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: 🚚 Install dependencies and build
run: |
pnpm install
pnpm build
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: ${{ secrets.VERDACCIO_URL }}
scope: '@univerjs'

- name: 🐙 Publish
run: |
if [[ ${{ needs.prepare.outputs.release_type }} == "alpha" ]]; then
pnpm publish --access public --tag ${{ needs.prepare.outputs.release_type }} -r --no-git-checks
else
pnpm publish --access public -r --no-git-checks
pnpm publish --access public --tag ${{ needs.prepare.outputs.release_type }} -r --no-git-checks
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.VERDACCIO_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

build-demo:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -149,29 +106,8 @@ jobs:
id: vercel-demo
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.ORG_ID}}
vercel-project-id: ${{ secrets.PROJECT_ID}}

sync-cnpm:
runs-on: ubuntu-latest
needs: [release-npm]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: ./.github/actions/setup-node

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: 🚚 Install dependencies
run: pnpm install cnpm -g

- name: 🐙 Sync to cnpm
run: pnpm sync:cnpm
vercel-org-id: ${{ secrets.ORG_ID }}
vercel-project-id: ${{ secrets.PROJECT_ID }}

build-storybook:
runs-on: ubuntu-latest
Expand All @@ -196,12 +132,12 @@ jobs:
id: vercel-storybook
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.ORG_ID}}
vercel-project-id: ${{ secrets.PROJECT_ID_STORYBOOK}}
vercel-org-id: ${{ secrets.ORG_ID }}
vercel-project-id: ${{ secrets.PROJECT_ID_STORYBOOK }}
vercel-args: --prod

notify:
needs: [release-npm, release-verdaccio, build-demo, build-storybook]
needs: [release-npm, build-demo, build-storybook]
runs-on: ubuntu-latest

steps:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/sync-mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: 🔮 Sync Mirror

on:
push:
branches: [main, dev]
branches:
- main
- dev

jobs:
sync:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/sync-pro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: 🔫 Sync to Pro

on:
push:
branches: [dev]
branches:
- dev

jobs:
update-submodules:
Expand Down
11 changes: 5 additions & 6 deletions common/shared/vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

const process = require('node:process');
const { resolve } = require('node:path');
const process = require('node:process');

const { defineConfig, mergeConfig } = require('vitest/config');
const { default: dts } = require('vite-plugin-dts');
const react = require('@vitejs/plugin-react');
const { default: dts } = require('vite-plugin-dts');
const { defineConfig, mergeConfig } = require('vitest/config');
const { autoExternalizeDependency } = require('./auto-externalize-dependency-plugin');
const { obfuscator } = require('./obfuscator');
const { buildPkg } = require('./build-pkg');
const { obfuscator } = require('./obfuscator');
const { convertLibNameFromPackageName } = require('./utils');

/**
Expand Down Expand Up @@ -78,8 +78,7 @@ function createViteConfig(overrideConfig, /** @type {IOptions} */ options) {
],
define: {
'process.env.NODE_ENV': JSON.stringify(mode),
'process.env.BUNDLE_TYPE': JSON.stringify(process.env.BUNDLE_TYPE ?? ''),
'process.env.BUILD_TIMESTAMP': JSON.stringify(parseInt(Date.now() / 1000)),
'process.env.BUILD_TIMESTAMP': JSON.stringify(Number.parseInt(Date.now() / 1000)),
},
test: {
css: {
Expand Down
13 changes: 5 additions & 8 deletions common/shared/vite/obfuscator.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,18 @@
* limitations under the License.
*/

const process = require('node:process');
const JavaScriptObfuscator = require('javascript-obfuscator');

exports.obfuscator = function obfuscator() {
return {
name: 'obfuscator',
enforce: 'post',
async generateBundle(_options, bundle) {
if (process.env.BUNDLE_TYPE === 'lite') {
for (const file in bundle) {
if (bundle[file].type === 'chunk' && /\.js$/.test(file)) {
const code = bundle[file].code;
const obfuscationResult = JavaScriptObfuscator.obfuscate(code);
bundle[file].code = obfuscationResult.getObfuscatedCode();
}
for (const file in bundle) {
if (bundle[file].type === 'chunk' && /\.js$/.test(file)) {
const code = bundle[file].code;
const obfuscationResult = JavaScriptObfuscator.obfuscate(code);
bundle[file].code = obfuscationResult.getObfuscatedCode();
}
}
},
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
"lint:fix": "eslint . --fix",
"storybook:dev": "pnpm --filter @univerjs/storybook dev:storybook",
"storybook:build": "pnpm --filter @univerjs/storybook build:storybook",
"release": "release-it",
"sync:cnpm": "turbo sync:cnpm"
"release": "release-it"
},
"devDependencies": {
"@antfu/eslint-config": "3.7.3",
Expand Down
3 changes: 1 addition & 2 deletions packages-experimental/debugger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
],
"scripts": {
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/data-validation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
"test": "vitest run",
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/design/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"clsx": ">=2.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/docs-drawing-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/docs-drawing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/docs-mention-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/docs-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/drawing-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/drawing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/engine-formula/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/engine-numfmt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/engine-render/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/facade/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/find-replace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
Loading

0 comments on commit ae2297d

Please sign in to comment.