diff --git a/.github/workflows/build-doc-site-aliyun-docker.yml b/.github/workflows/build-doc-site-aliyun-docker.yml new file mode 100644 index 000000000..5efc8c453 --- /dev/null +++ b/.github/workflows/build-doc-site-aliyun-docker.yml @@ -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 diff --git a/.github/workflows/docker-build-doc-site.yml b/.github/workflows/build-doc-site-docker.yml similarity index 90% rename from .github/workflows/docker-build-doc-site.yml rename to .github/workflows/build-doc-site-docker.yml index 2a01ead37..ce9daab66 100644 --- a/.github/workflows/docker-build-doc-site.yml +++ b/.github/workflows/build-doc-site-docker.yml @@ -1,4 +1,4 @@ -name: docker-build-doc-site +name: build-doc-site-docker # on: push on: @@ -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: diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml index d1f69f4fd..e6c3d8ffc 100644 --- a/.github/workflows/deploy-site.yml +++ b/.github/workflows/deploy-site.yml @@ -4,7 +4,7 @@ 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: diff --git a/.github/workflows/mirror-gitee.yml b/.github/workflows/mirror-gitee.yml index fa5c18783..231f0ee97 100644 --- a/.github/workflows/mirror-gitee.yml +++ b/.github/workflows/mirror-gitee.yml @@ -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 diff --git a/schematics/application/index.spec.ts b/schematics/application/index.spec.ts index 6ab57270c..3b4c8fb01 100644 --- a/schematics/application/index.spec.ts +++ b/schematics/application/index.spec.ts @@ -23,6 +23,10 @@ describe('NgAlainSchematic: application', () => { const angualrJson = tree.readContent('angular.json'); expect(angualrJson).toContain(`fileReplacements`); }); + it('should be add src/assets', () => { + const angualrJson = tree.readContent('angular.json'); + expect(angualrJson).toContain(`"src/assets"`); + }); }); describe('#i18n', () => { diff --git a/schematics/application/index.ts b/schematics/application/index.ts index 73d556099..e3f3ebc60 100644 --- a/schematics/application/index.ts +++ b/schematics/application/index.ts @@ -27,6 +27,7 @@ import { addPackage, addSchematicCollections, addStylePreprocessorOptions, + addStyleResources, BUILD_TARGET_BUILD, BUILD_TARGET_SERVE, DEFAULT_WORKSPACE_PATH, @@ -80,6 +81,7 @@ function fixAngularJson(): Rule { if (serveTarget.options == null) serveTarget.options = {}; serveTarget.options.proxyConfig = 'proxy.conf.js'; + addStyleResources(workspace, projectName); addStylePreprocessorOptions(workspace, projectName); addSchematicCollections(workspace); addFileReplacements(workspace, projectName); diff --git a/schematics/test.ts b/schematics/test.ts index 91a5df248..17c914f51 100644 --- a/schematics/test.ts +++ b/schematics/test.ts @@ -12,8 +12,8 @@ require('source-map-support').install({ const Jasmine = require('jasmine'); const runner = new Jasmine({ projectBaseDir }); -// const files = `schematics/**/*.spec.ts`; -const files = `schematics/ng-update/upgrade-rules/V18/index.spec.ts`; +const files = `schematics/**/*.spec.ts`; +// const files = `schematics/application/index.spec.ts`; const tests = glob.sync(files).map(p => relative(projectBaseDir, p)); diff --git a/schematics/utils/workspace.ts b/schematics/utils/workspace.ts index 2540260e0..58867fad6 100644 --- a/schematics/utils/workspace.ts +++ b/schematics/utils/workspace.ts @@ -177,6 +177,17 @@ export function addStylePreprocessorOptions(workspace: WorkspaceDefinition, proj build.options.stylePreprocessorOptions['includePaths'] = includePaths; } +export function addStyleResources(workspace: WorkspaceDefinition, projectName: string): void { + const project = getProjectFromWorkspace(workspace, projectName); + if (project == null) return; + + const build = project.targets.get(BUILD_TARGET_BUILD); + if (build == null || build.options == null) return; + + if (!Array.isArray(build.options.assets)) build.options.assets = []; + (build.options.assets as string[]).push(`src/assets`); +} + export function addSchematicCollections(workspace: WorkspaceDefinition): void { const cli = workspace.extensions.cli as Record; if (cli && cli.schematicCollections) return;