From 58d8acac38ab0e6671b3d75075c76c1a1c84cd39 Mon Sep 17 00:00:00 2001 From: lvisei Date: Fri, 6 May 2022 20:17:51 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=96=B0=E5=A2=9E=20release=20label=20ac?= =?UTF-8?q?tion=20(#1097)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: new scripts dir * ci: 新增 release label action * ci: 修改部署 token --- .github/release.yaml | 24 +++++++++++++++++ .github/workflows/lint.yml | 18 +++++++++++++ .github/workflows/mirror.yml | 11 -------- .github/workflows/preview.yml | 26 ++++++++++++------- .github/workflows/release-label.yml | 14 ++++++++++ .github/workflows/release.yml | 40 +++++++++++++++++++++++++++++ .gitignore | 5 ---- lerna.json | 16 ++++-------- package.json | 18 ++++++------- packages/three/package.json | 2 +- beta.sh => scripts/beta.sh | 0 latest.sh => scripts/latest.sh | 0 mini.sh => scripts/mini.sh | 0 publish.sh => scripts/publish.sh | 2 +- tbeta.sh => scripts/tbeta.sh | 0 15 files changed, 129 insertions(+), 47 deletions(-) create mode 100644 .github/release.yaml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/release-label.yml create mode 100644 .github/workflows/release.yml rename beta.sh => scripts/beta.sh (100%) rename latest.sh => scripts/latest.sh (100%) rename mini.sh => scripts/mini.sh (100%) rename publish.sh => scripts/publish.sh (98%) rename tbeta.sh => scripts/tbeta.sh (100%) diff --git a/.github/release.yaml b/.github/release.yaml new file mode 100644 index 0000000000..8f481b7e20 --- /dev/null +++ b/.github/release.yaml @@ -0,0 +1,24 @@ +# for .github/workflows/release-label.yml + +changelog: + exclude: + labels: + - ignore-for-release + - chore + categories: + - title: 🎉 New Features + labels: + - feature + - enhancement + - title: 📖 Documentation Changes + labels: + - documentation + - title: 🐛 Bug Fixes + labels: + - bugfix + - title: 🛠 Breaking Changes + labels: + - breaking + - title: Other Changes + labels: + - "*" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000..4be9a6cd76 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,18 @@ +name: lint + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14.x] + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - run: yarn + - run: yarn lint diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml index eed65b5669..57eb05eea9 100644 --- a/.github/workflows/mirror.yml +++ b/.github/workflows/mirror.yml @@ -17,17 +17,6 @@ jobs: # 注意替换为你的 Gitee 目标仓库地址 destination-repo: 'git@gitee.com:antv-l7/antv-l7.git' - - name: 🔁 Sync to Gitee - uses: wearerequired/git-mirror-action@master - env: - # 注意在 Settings->Secrets 配置 GITEE_RSA_PRIVATE_KEY - SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} - with: - # 注意替换为你的 GitHub 源仓库地址 - source-repo: 'git@github.com:antvis/L7.git' - # 注意替换为你的 Gitee 目标仓库地址 - destination-repo: 'git@gitee.com:antv/L7.git' - - name: ✅ Build Gitee Pages uses: yanglbme/gitee-pages-action@master with: diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 371104cc8c..760b52b876 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -5,13 +5,21 @@ on: pull_request jobs: preview: runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14.x] steps: - - uses: actions/checkout@v2 - - uses: afc163/surge-preview@v1 - with: - surge_token: ${{ secrets.SURGE_TOKEN }} - github_token: ${{ secrets.GITHUB_TOKEN }} - build: | - yarn --frozen-lockfile - yarn site:build - dist: public + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - uses: afc163/surge-preview@v1 + with: + surge_token: ${{ secrets.SURGE_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + dist: public + build: | + yarn --frozen-lockfile + yarn site:build + diff --git a/.github/workflows/release-label.yml b/.github/workflows/release-label.yml new file mode 100644 index 0000000000..61f39e08d8 --- /dev/null +++ b/.github/workflows/release-label.yml @@ -0,0 +1,14 @@ +# Warning, do not check out untrusted code with +# the pull_request_target event. +on: + pull_request_target: + types: [ opened, edited ] +name: conventional-release-labels +jobs: + label: + runs-on: ubuntu-latest + steps: + - uses: bcoe/conventional-release-labels@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + type_labels: '{"feat": "feature", "fix": "bugfix", "breaking": "breaking", "docs": "documentation", "chore": "chore"}' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..dd15263f76 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,40 @@ +name: release + +on: + release: + types: [created, edited] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 14 + - run: yarn + - run: yarn lint + + publish-site: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 14 + - run: yarn + - run: yarn site:build + - run: | + cd public + git init + git config --local user.name antv + git config --local user.email antv@antfin.com + git add . + git commit -m "update by release action" + - uses: ad-m/github-push-action@master + with: + github_token: ${{secrets.GITHUB_TOKEN}} + directory: public + branch: gh-pages + force: true diff --git a/.gitignore b/.gitignore index fc0d723a6c..c241e2de7f 100644 --- a/.gitignore +++ b/.gitignore @@ -84,8 +84,3 @@ stories/Test packages/draw/node_modules/@turf packages/district/src/data -# npm command lines -publish.sh -latest.sh -beta.sh -mini.sh diff --git a/lerna.json b/lerna.json index bde2b90969..42bd0a191d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,17 +1,11 @@ { - "packages": [ - "packages/*" - ], + "packages": ["packages/*"], "command": { "publish": { - "ignoreChanges": [ - "*.md" - ], - "allowBranch": [ - "publish", - "docs" - ], - "message": "chore: publish" + "ignoreChanges": ["*.md"], + "allowBranch": ["publish", "docs"], + "message": "chore: publish", + "registry": "https://registry.npmjs.org" } }, "version": "2.8.35", diff --git a/package.json b/package.json index 78b7c754c3..7690bd3ab8 100644 --- a/package.json +++ b/package.json @@ -145,13 +145,14 @@ "site:clean": "gatsby clean", "site:deploy": "yarn run site:build && gh-pages -d public", "site:publish": "gh-pages -d public", - "lint:fix": "prettier --write docs/api/**/*.md docs/api/*.md stories/**/**/*.tsx *.md", - "lint:examples": "eslint examples --fix --ext .js", + "storybook": "start-storybook -p 6006", "prebuild": "run-p tsc lint", "build": "yarn clean && lerna run build", "postbuild": "yarn build:declarations", "build:declarations": "lerna exec --stream --no-bail 'tsc --project ./tsconfig.build.json'", "fix": "run-p -c 'lint:ts-* --fix'", + "lint:fix": "prettier --write docs/api/**/*.md docs/api/*.md stories/**/**/*.tsx *.md", + "lint:examples": "eslint examples --fix --ext .js", "lint:css": "stylelint 'packages/**/*.js{,x}'", "lint:ts-prod": "tslint --fix --config tslint.prod.json 'packages/**/*.ts{,x}'", "lint:ts-test": "tslint --fix --config tslint.json 'packages/**/*.{spec,story}.ts{,x}'", @@ -161,19 +162,18 @@ "version": "lerna version --force-publish --conventional-commits --exact --no-changelog", "version:prerelease": "lerna version --force-publish --conventional-prerelease", "prerelease": "yarn build && yarn bundle", - "release-beta": "yarn run prerelease && lerna publish --dist-tag beta from-package --registry https://registry.npmjs.org/ --force-publish && lerna run sync", - "release": "lerna publish from-package --registry https://registry.npmjs.org/ --force-publish && lerna run sync", + "release-beta": "yarn run prerelease && lerna publish --dist-tag beta from-package --force-publish && lerna run sync", + "release": "lerna publish from-package --force-publish && lerna run sync", "release-cdn": "antv-bin upload -n @antv/l7", - "storybook": "start-storybook -p 6006", "test": "cross-env BABEL_ENV=test jest", "test-live": "cross-env BABEL_ENV=test DEBUG_MODE=1 jest --watch", "coveralls": "jest --coverage && cat ./tests/coverage/lcov.info | coveralls", "tsc": "tsc", "watch": "yarn clean && lerna exec --parallel -- cross-env BABEL_ENV=cjs NODE_ENV=production babel --watch src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments", - "bundle": "cross-env BABEL_ENV=bundle NODE_ENV=production node_modules/.bin/rollup -c ./build/rollup.config.js --environment BUILD:production,MINIFY:true", - "bundle-dev": "cross-env BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js --environment 'BUILD:production,MINIFY:false'", - "bundle:watch": "cross-env BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js --watch", - "glsl-minify": "node_modules/.bin/glsl-minifier -i ./build/example.frag -o ./build/example.min.frag", + "bundle": "cross-env BABEL_ENV=bundle NODE_ENV=production yarn rollup -c build/rollup.config.js --environment BUILD:production,MINIFY:true", + "bundle-dev": "cross-env BABEL_ENV=bundle yarn rollup -c build/rollup.config.js --environment BUILD:production,MINIFY:false", + "bundle:watch": "cross-env BABEL_ENV=bundle yarn rollup -c build/rollup.config.js --watch", + "glsl-minify": "yarn glsl-minifier -i build/example.frag -o build/example.min.frag", "clean": "lerna run clean", "sync": "lerna run sync" }, diff --git a/packages/three/package.json b/packages/three/package.json index f25528be3d..4687fcbaa4 100644 --- a/packages/three/package.json +++ b/packages/three/package.json @@ -34,7 +34,7 @@ "build:cjs": "BABEL_ENV=cjs babel src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments", "build:esm": "BABEL_ENV=esm babel src --root-mode upward --out-dir es --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments", "watch": "BABEL_ENV=cjs babel src --watch --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments", - "build:cdn": "node_modules/.bin/rollup -c", + "build:cdn": "yarn rollup -c", "lint:ts": "run-p -c lint:ts-*", "test": "jest", "sync": "tnpm sync" diff --git a/beta.sh b/scripts/beta.sh similarity index 100% rename from beta.sh rename to scripts/beta.sh diff --git a/latest.sh b/scripts/latest.sh similarity index 100% rename from latest.sh rename to scripts/latest.sh diff --git a/mini.sh b/scripts/mini.sh similarity index 100% rename from mini.sh rename to scripts/mini.sh diff --git a/publish.sh b/scripts/publish.sh similarity index 98% rename from publish.sh rename to scripts/publish.sh index 09a1f83d5a..8368b497d9 100644 --- a/publish.sh +++ b/scripts/publish.sh @@ -48,4 +48,4 @@ cd ./utils/ npm publish cd .. -cd .. \ No newline at end of file +cd .. diff --git a/tbeta.sh b/scripts/tbeta.sh similarity index 100% rename from tbeta.sh rename to scripts/tbeta.sh