Skip to content

Commit

Permalink
Merge branch '30215-select-existing-file-show-hostfolder-on-the-left'…
Browse files Browse the repository at this point in the history
… of github.com:dotCMS/core into 30215-select-existing-file-show-hostfolder-on-the-left
  • Loading branch information
nicobytes committed Nov 5, 2024
2 parents 54cd5e4 + b4dd221 commit 4748500
Show file tree
Hide file tree
Showing 204 changed files with 11,999 additions and 4,970 deletions.
72 changes: 72 additions & 0 deletions .github/actions/core-cicd/deployment/deploy-javadoc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Deploy Artifact Javadoc Composite Action

This GitHub composite action deploys Javadoc artifacts to the GitHub Packages registry and an AWS S3 bucket. It uses Maven to generate the Javadocs and AWS CLI to upload the generated documentation to a specified S3 URI.

## Inputs

- **ref**:
*Description*: Branch to build from.
*Required*: No
*Default*: `main`

- **github-token**:
*Description*: GitHub Token for authentication.
*Required*: Yes

- **release-version**:
*Description*: The version of the release.
*Required*: Yes

- **artifact-run-id**:
*Description*: The run ID of the core artifacts to restore classes from.
*Required*: No

- **aws-access-key-id**:
*Description*: AWS Access Key ID for authentication.
*Required*: Yes

- **aws-secret-access-key**:
*Description*: AWS Secret Access Key for authentication.
*Required*: Yes

- **aws-region**:
*Description*: AWS region for deployment.
*Required*: Yes
*Default*: `us-east-1`

## Steps

1. **Checkout**: Uses the `actions/checkout@v4` action to check out the specified branch.
2. **Maven Clean Build**: Runs a Maven clean install to build the project (skipping tests), only if `artifact-run-id` is not provided.
3. **Deploy Javadoc**: Runs Maven to generate Javadocs and restores classes from the specified artifact run ID if provided.
4. **Configure AWS Credentials**: Configures AWS credentials using the `aws-actions/configure-aws-credentials@v1` action.
5. **Generate/Push Javadoc**: Uploads the generated Javadoc to an S3 bucket using the AWS CLI.

## Example Usage

```yaml
name: Deploy Javadoc Workflow
on:
push:
branches:
- main

jobs:
deploy-javadoc:
runs-on: ubuntu-latest
steps:
- name: Deploy Artifact Javadoc
uses: ./.github/actions/deploy-artifact-javadoc
with:
ref: 'main'
github-token: ${{ secrets.GITHUB_TOKEN }}
release-version: '1.0.0'
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: 'us-east-1'
```
# Notes
- Ensure that the github-token, aws-access-key-id, and aws-secret-access-key inputs are provided securely using GitHub secrets.
- The artifact-run-id is optional and can be used to restore classes from previous artifact runs if necessary.
78 changes: 78 additions & 0 deletions .github/actions/core-cicd/deployment/deploy-javadoc/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Deploy Artifact Javadoc
description: Deploys the Javadoc artifact to the GitHub Packages registry
inputs:
ref:
description: 'Branch to build from'
required: false
default: 'main'
github-token:
description: 'GitHub Token'
required: true
release-version:
description: 'The version of the release'
required: true
artifact-run-id:
description: 'The run id of the core artifacts'
aws-access-key-id:
description: 'AWS Access Key ID'
required: true
aws-secret-access-key:
description: 'AWS Secret Access Key'
required: true
aws-region:
description: 'AWS region'
default: 'us-east-1'
required: true

runs:
using: "composite"
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- uses: ./.github/actions/core-cicd/maven-job
id: maven-clean
with:
stage-name: "Clean Build"
maven-args: "clean install -DskipTests"
generate-docker: false
cleanup-runner: true
github-token: ${{ inputs.github-token }}
if: inputs.artifact-run-id == ''

- uses: ./.github/actions/core-cicd/maven-job
id: maven-javadoc
with:
stage-name: "Deploy Javadoc"
maven-args: "javadoc:javadoc -pl :dotcms-core"
generate-docker: false
cleanup-runner: true
restore-classes: true
artifacts-from: ${{ inputs.artifact-run-id }}
github-token: ${{ inputs.github-token }}

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ inputs.aws-access-key-id }}
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
aws-region: ${{ inputs.aws-region }}

- name: Generate/Push Javadoc
if: success()
run: |
echo "::group::Generate/Push Javadoc"
site_dir=./dotCMS/target/site
javadoc_dir=${site_dir}/javadocs
s3_uri=s3://static.dotcms.com/docs/${{ inputs.release-version }}/javadocs
mv ${site_dir}/apidocs ${javadoc_dir}
# ls -R $javadoc_dir
echo "Running: aws s3 cp ${javadoc_dir} ${s3_uri} --recursive"
aws s3 cp ${javadoc_dir} ${s3_uri} --recursive
echo "::endgroup::"
env:
AWS_ACCESS_KEY_ID: ${{ inputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.aws-secret-access-key }}
shell: bash
2 changes: 2 additions & 0 deletions .github/actions/core-cicd/maven-job/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ runs:
name: "build-classes"
path: |
**/target/classes/**/*.class
**/target/generated-sources/**/*.java
**/target/test-classes/**/*.class
LICENSE
- id: delete-built-artifacts-from-cache
Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/cicd_manual_publish-starter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
options:
- 'full'
- 'empty'
old-assets:
description: 'Include old assets'
required: true
type: boolean
changelog:
description: 'Changes description'
required: true
Expand All @@ -28,7 +32,7 @@ env:
EMPTY_STARTER_TOKEN: ${{ secrets.DOT_EMPTY_STARTER_ACCESS_TOKEN }}
FULL_STARTER_URL: ${{ vars.DOT_STARTER_URL }}
FULL_STARTER_TOKEN: ${{ secrets.DOT_STARTER_ACCESS_TOKEN }}
DOWNLOAD_ENDPOINT: api/v1/maintenance/_downloadStarterWithAssets?oldAssets=false
DOWNLOAD_ENDPOINT: api/v1/maintenance/_downloadStarterWithAssets?oldAssets=${{ github.event.inputs.old-assets }}

jobs:
get-starter:
Expand Down Expand Up @@ -88,7 +92,7 @@ jobs:
deploy-artifacts:
needs: [ get-starter ]
runs-on: ubuntu-20.04
environment: trunk
environment: starter
outputs:
filename: ${{ steps.deploy-artifacts.outputs.filename }}
url: ${{ steps.deploy-artifacts.outputs.url }}
Expand Down Expand Up @@ -153,10 +157,10 @@ jobs:
echo "::endgroup::"
update-pom:
if: ${{ github.event.inputs.type == 'empty' && github.event.inputs.dry-run == false }}
if: ${{ github.event.inputs.type == 'empty' && github.event.inputs.dry-run == 'false' }}
needs: [ deploy-artifacts ]
runs-on: ubuntu-20.04
environment: trunk
environment: starter
outputs:
pull-request-url: ${{ steps.create-pull-request.outputs.pull-request-url }}
steps:
Expand Down Expand Up @@ -201,10 +205,9 @@ jobs:
automated pr
send-notification:
needs: [ deploy-artifacts, update-pom ]
needs: [ deploy-artifacts ]
runs-on: ubuntu-20.04
environment: trunk
if: always() && github.event.inputs.dry-run == false
if: always() && github.event.inputs.dry-run == 'false'
steps:

- uses: actions/checkout@v4
Expand All @@ -215,6 +218,7 @@ jobs:
echo "::group::Compose Message"
ARTIFACT_FILENAME="${{ needs.deploy-artifacts.outputs.filename }}"
ARTIFACT_URL="${{ needs.deploy-artifacts.outputs.url }}"
OLD_ASSETS="${{ github.event.inputs.old-assets }}"
CHANGELOG="${{ github.event.inputs.changelog }}"
PULL_REQUEST_URL="${{ needs.update-pom.outputs.pull-request-url }}"
if [ "$STARTER_TYPE" == "empty" ]; then
Expand All @@ -226,6 +230,7 @@ jobs:
> This automated script is happy to announce that a new *_${STARTER_TYPE} starter_* :package: \`${ARTIFACT_FILENAME}\` is now available on \`ARTIFACTORY\` :frog:!
>
> :link: ${ARTIFACT_URL}
> _Old assets included_: ${OLD_ASSETS}
> *Changelog*
> \`\`\`${CHANGELOG}\`\`\`
>
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/legacy-release_maven-release-process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -433,4 +433,4 @@ jobs:
SLACK_FOOTER: ""
SLACK_ICON: https://avatars.slack-edge.com/temp/2021-12-08/2830145934625_e4e464d502865ff576e4.png
SLACK_MESSAGE: "<!channel> This automated script is excited to announce the release of a new version of dotCMS `${{ needs.prepare-release.outputs.release_version }}` :rocket:\n:docker: Produced images: [${{ needs.build-push-image.outputs.formatted_tags }}]"
if: success() && github.event.inputs.notify_slack == 'true'
if: success() && github.event.inputs.notify_slack == 'true'
3 changes: 3 additions & 0 deletions core-web/libs/dotcms-models/src/lib/dot-contentlet.model.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Beware while using this type, since we have a [key: string]: any; it can be used to store any kind of data and you can write wrong properties and it will not fail
// Maybe we need to refactor this to a generic type that extends from unknown when missing the generic type
export interface DotCMSContentlet {
archived: boolean;
baseType: string;
Expand Down Expand Up @@ -36,6 +38,7 @@ export interface DotCMSContentlet {
contentTypeIcon?: string;
variant?: string;
__icon__?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { By } from '@angular/platform-browser';
import { MessageService } from 'primeng/api';
import { Dialog } from 'primeng/dialog';

import { CLIENT_ACTIONS } from '@dotcms/client';
import {
DotAlertConfirmService,
DotContentTypeService,
Expand Down Expand Up @@ -178,11 +179,12 @@ describe('DotEmaDialogComponent', () => {
event: expect.objectContaining({
isTrusted: false
}),
payload: PAYLOAD_MOCK,
actionPayload: PAYLOAD_MOCK,
form: {
status: FormStatus.PRISTINE,
isTranslation: false
}
},
clientAction: CLIENT_ACTIONS.NOOP
});
});

Expand All @@ -200,11 +202,12 @@ describe('DotEmaDialogComponent', () => {
name: NG_CUSTOM_EVENTS.DIALOG_CLOSED
}
}),
payload: PAYLOAD_MOCK,
actionPayload: PAYLOAD_MOCK,
form: {
status: FormStatus.PRISTINE,
isTranslation: false
}
},
clientAction: CLIENT_ACTIONS.NOOP
});
});
});
Expand Down Expand Up @@ -331,7 +334,7 @@ describe('DotEmaDialogComponent', () => {
containerId: PAYLOAD_MOCK.container.identifier,
acceptTypes: PAYLOAD_MOCK.container.acceptTypes,
language_id: PAYLOAD_MOCK.language_id,
payload: PAYLOAD_MOCK
actionPayload: PAYLOAD_MOCK
});
});

Expand All @@ -352,7 +355,7 @@ describe('DotEmaDialogComponent', () => {
containerId: PAYLOAD_MOCK.container.identifier,
acceptTypes: DotCMSBaseTypesContentTypes.WIDGET,
language_id: PAYLOAD_MOCK.language_id,
payload: PAYLOAD_MOCK
actionPayload: PAYLOAD_MOCK
});
});

Expand All @@ -379,10 +382,7 @@ describe('DotEmaDialogComponent', () => {

component.editContentlet(PAYLOAD_MOCK.contentlet);

expect(editContentletSpy).toHaveBeenCalledWith({
inode: PAYLOAD_MOCK.contentlet.inode,
title: PAYLOAD_MOCK.contentlet.title
});
expect(editContentletSpy).toHaveBeenCalledWith(PAYLOAD_MOCK.contentlet);
});

it('should trigger editVTLContentlet in the store', () => {
Expand Down Expand Up @@ -418,13 +418,13 @@ describe('DotEmaDialogComponent', () => {
component.createContentlet({
url: 'https://demo.dotcms.com/jsp.jsp',
contentType: 'test',
payload: PAYLOAD_MOCK
actionPayload: PAYLOAD_MOCK
});

expect(createContentletSpy).toHaveBeenCalledWith({
contentType: 'test',
url: 'https://demo.dotcms.com/jsp.jsp',
payload: PAYLOAD_MOCK
actionPayload: PAYLOAD_MOCK
});
});

Expand All @@ -437,12 +437,12 @@ describe('DotEmaDialogComponent', () => {
component.createContentletFromPalette({
variable: 'test',
name: 'test',
payload: PAYLOAD_MOCK
actionPayload: PAYLOAD_MOCK
});

expect(createContentletFromPalletSpy).toHaveBeenCalledWith({
name: 'test',
payload: PAYLOAD_MOCK,
actionPayload: PAYLOAD_MOCK,
variable: 'test'
});
});
Expand Down
Loading

0 comments on commit 4748500

Please sign in to comment.