-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…0535) ### Proposed Changes * This Pull Request introduces a new composite action named deploy-javadoc, based on the Generate/Push Javadoc step from maven-release-process.yml. The main objective of this action is to modularize the behavior for generating and deploying Javadocs, providing a more reusable and consistent solution within the CI/CD workflow. ### Key changes: - Integration with the maven-job action to reuse artifacts from previous stages. - Use of Maven cache to optimize performance. - Availability of Java classes generated during the compilation process, essential for creating immutable objects. ### Additional Info This PR resolves #28550 (Create deploy-javadoc composite action base).
- Loading branch information
Showing
4 changed files
with
153 additions
and
1 deletion.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
.github/actions/core-cicd/deployment/deploy-javadoc/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
78
.github/actions/core-cicd/deployment/deploy-javadoc/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters