Skip to content

Commit

Permalink
chore: project ci utils
Browse files Browse the repository at this point in the history
  • Loading branch information
devcui committed Jul 3, 2024
1 parent f60ae25 commit 9a092c5
Show file tree
Hide file tree
Showing 20 changed files with 126 additions and 157 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build-doc-site-aliyun-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: build-doc-site-aliyun-docker

# on: push
on:
push:
branches:
- master

jobs:
website:
if: "startsWith(github.event.head_commit.message, 'release')"
runs-on: ubuntu-latest
environment: prod
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login Docker
uses: docker/login-action@v2
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALIYUN_USERNAME }}
password: ${{ secrets.ALIYUN_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.docs
push: true
tags: registry.cn-hangzhou.aliyuncs.com/alain/docs:latest
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
website:
if: "startsWith(github.event.commits[0].message, 'release')"
if: "startsWith(github.event.head_commit.message, 'release')"
runs-on: ubuntu-latest
environment: prod
steps:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand All @@ -92,7 +92,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand All @@ -109,7 +109,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ on: push

jobs:
website:
if: "startsWith(github.event.commits[0].message, 'release')"
if: "startsWith(github.event.head_commit.message, 'release')"
runs-on: ubuntu-latest
environment: prod
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- run: yarn install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mirror-gitee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: push

jobs:
to_gitee:
if: "!startsWith(github.event.commits[0].message, 'release')"
if: "!startsWith(github.event.head_commit.message, 'release')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"source.fixAll.stylelint": "explicit"
},
"[html]": {
"editor.formatOnSave": true
"editor.formatOnSave": false
},
"[typescript]": {
"editor.formatOnSave": true
Expand Down
52 changes: 0 additions & 52 deletions docs/upgrade-v17.en-US.md

This file was deleted.

53 changes: 0 additions & 53 deletions docs/upgrade-v17.zh-CN.md

This file was deleted.

32 changes: 32 additions & 0 deletions docs/upgrade-v18.en-US.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
order: 1000
type: Basic
title: Upgrade to version 18.0
hot: true
---

> This guide applies to the current version ng-yunzai >= `17`;
> If you encounter problems during the upgrade process, feel free to comment here.
> If you find any errors in this guide, please point out
> Or you have encountered a new problem and solved it, welcome to comment here.

## Before upgrade

1. Make sure `Node.js` >= `18.19.1`.
2. Create a new branch, or use other methods to back up the current project.
3. Delete the `package-lock.json` or `yarn.lock` file.
4. Remove `"postinstall": "ng-less-javascript-enabled-patch"` in `package.json`.

### 1.Upgrade dependencies

- Upgrade Angular to 17.x version, Run `ng update @angular/core@18 @angular/cli@18 @angular-eslint/schematics@18 ng-zorro-antd@18 ng-yunzai@18`.
- _Run `ng update @angular/cdk@18`, if you have used `@angular/cdk`._

> NG-ALAIN scaffolding upgrade all change files, please refer to: :[#2394](https://github.com/hbyunzai/ng-yunzai/pull/2504/files).
### QA

**throw new Error(`Not found ${lessLangPath}`);**

Please remove `"postinstall": "ng-less-javascript-enabled-patch"` first, save the file and then upgrade. `ng-less-javascript-enabled-patch` will be automatically deleted during the upgrade.
33 changes: 33 additions & 0 deletions docs/upgrade-v18.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
order: 1000
type: Basic
title: 升级到 18.0 版本
hot: true
---

> 本指南适用于当前版本 ng-yunzai >= `17` ;
> 如果在升级过程中遇到问题,欢迎提出。提问前请阅读 [如何向开源社区提问题](https://github.com/seajs/seajs/issues/545)
> 如果发现本指南存在遗漏/错误,请指出!
> 或者你遇到了新的问题并解决了,欢迎补充!
## 开始之前

1. 首先确保你 `Node.js` >= `18.19.1`
2. 创建新的分支,或者使用其他方式备份当前项目
3. 删除项目下 `package-lock.json``yarn.lock` 文件
4. 移除 `package.json` 中的 `"postinstall": "ng-less-javascript-enabled-patch"`

## 升级步骤

### 升级相关依赖

- 将项目升级到 Angular 17 运行 `ng update @angular/core@18 @angular/cli@18 @angular-eslint/schematics@18 ng-zorro-antd@18 ng-yunzai@18`
- _如果你有单独使用 `@angular/cdk` 请执行 `ng update @angular/cdk@18`_

> NG-ALAIN脚手架升级全部变更文件,请参考:[#2394](https://github.com/hbyunzai/ng-yunzai/pull/2504/files)
### QA

**throw new Error(`Not found ${lessLangPath}`);**

请先移除 `"postinstall": "ng-less-javascript-enabled-patch"` 保存后再进行升级,`ng-less-javascript-enabled-patch` 会在升级中自动删除。
5 changes: 4 additions & 1 deletion scripts/build/copy-less.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function copyLess(name) {
let sourcePath = path.join(root, `packages/${name}`);
let targetPath = path.join(root, `dist/@yelon/${name}`);
// index.less
[`index.less`, `theme-default.less`, `theme-dark.less`, `theme-compact.less`]
[`index.less`, `theme-default.less`, `theme-dark.less`, `theme-compact.less`, `theme-variable.less`]
.filter(fileName => fse.existsSync(`${sourcePath}/${fileName}`))
.forEach(fileName => {
fse.copySync(`${sourcePath}/${fileName}`, `${targetPath}/${fileName}`);
Expand All @@ -27,13 +27,16 @@ function copyLess(name) {
function copyTheme() {
[
'system',
'mixins.less',
'index.less',
'default.less',
'dark.less',
'compact.less',
'variable.less',
`theme-default.less`,
`theme-dark.less`,
`theme-compact.less`,
`theme-variable.less`,
].forEach(fileName => {
fse.copySync(path.join(root, `packages/theme/${fileName}`), path.join(root, `dist/@yelon/theme/${fileName}`));
});
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/generate-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function genCss(name, min) {
}

function runCss(min) {
['default', 'dark', 'compact'].forEach(async name => {
['default', 'dark', 'compact', 'variable'].forEach(async name => {
console.log(`开始生成 ${name} ${min ? 'min' : ''}版本`);
await genCss(name, min);
});
Expand Down
10 changes: 6 additions & 4 deletions scripts/ci/build-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,19 @@ git config credential.helper "store --file=.git/credentials"
echo "https://${ACCESS_TOKEN}:@github.com" > .git/credentials

if [[ $(git ls-remote origin "refs/tags/${buildTagName}") ]]; then
echo "removed tag because tag is already published"
# git push origin :refs/tags/${buildTagName}
git push --delete origin ${buildTagName}
echo "removed tag because tag is already published"
git push --delete origin ${buildTagName}
git push origin :refs/tags/${buildTagName}
sleep 5
fi

echo "Git configuration has been updated to match the last commit author. Publishing now.."

git add -A
git commit --allow-empty -m "${buildCommitMessage}"
git tag "${buildTagName}"
git push origin ${branchName} --tags
git push origin ${branchName} --tags -f


echo "Published package artifacts for ${packageName}#${buildVersionName} into ${branchName}"

Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/build-schematics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ copyFiles() {
# mock
"${1}_mock/_user.ts|${2}application/files/root/_mock/"
# src
"${1}src/favicon.ico|${2}application/files/src/"
"${1}public/favicon.ico|${2}application/files/public/"
"${1}src/typings.d.ts|${2}application/files/src/"
"${1}src/environments|${2}application/files/src/"
"${1}src/styles|${2}application/files/src/"
Expand Down
5 changes: 3 additions & 2 deletions scripts/ci/build-yelon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ buildLess() {
node ./scripts/build/copy-less.js
echo 'fix zorro path...'
node ./scripts/build/fix-zorro-path.js
echo 'build full css...'
node ./scripts/build/generate-css.js
# TODO: https://github.com/NG-ZORRO/ng-zorro-antd/issues/8618
# echo 'build full css...'
# node ./scripts/build/generate-css.js
}

addBanners() {
Expand Down
30 changes: 0 additions & 30 deletions scripts/ci/lint.sh

This file was deleted.

Loading

0 comments on commit 9a092c5

Please sign in to comment.