From f8edebfabfc30de725e30c84b6d11011774bab64 Mon Sep 17 00:00:00 2001 From: Evgeny Biriulin Date: Wed, 16 Aug 2023 03:08:55 +0400 Subject: [PATCH] feat: support shared storage bucket --- README.md | 3 +++ action.yml | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 298fdcb..144534d 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ ## Inputs - `revision` (required) - The revision or version identifier for the documentation to be built. +- `project-name` (required) - The documentation's project name, as specified in the configuration file's field with the corresponding name. - `src-root` (required) - The root directory where the source documentation files are located. The action will use this directory as the base location to look for the source files that need to be built. - `storage-bucket` (required) - The name of the storage bucket where the built documentation will be stored. After the documentation is successfully built, it will be uploaded to this specified bucket. - `storage-endpoint` (required) - The endpoint URL of the storage service. @@ -11,6 +12,7 @@ - `storage-region` (required) - The region where the specified storage bucket is located. - `lint-root` (default: `./_docs-lint`) - The root directory for the linting process. This is an optional parameter, and if not specified, the default value will be used. - `build-root` (default: `./_docs-build`) - The root directory for the built documentation. This is an optional parameter, and if not specified, the default value will be used. +- `shared-storage-bucket` (default: `false`) - This argument specifies whether the storage bucket should be shared across multiple projects. ## Example @@ -30,6 +32,7 @@ jobs: uses: diplodoc-platform/docs-build-action@v1 with: revision: "pr-${{ github.event.pull_request.number }}" + project-name: ${{ secrets.DOCS_PROJECT_NAME }} src-root: "./docs" storage-bucket: ${{ secrets.DOCS_AWS_BUCKET }} storage-endpoint: ${{ vars.DOCS_AWS_ENDPOINT }} diff --git a/action.yml b/action.yml index d83a814..bb46a66 100644 --- a/action.yml +++ b/action.yml @@ -4,6 +4,8 @@ description: Build & Upload Docs inputs: revision: required: true + project-name: + required: true src-root: required: true storage-bucket: @@ -20,6 +22,8 @@ inputs: default: "./_docs-lint" build-root: default: "./_docs-build" + shared-storage-bucket: + default: false runs: using: composite @@ -40,7 +44,7 @@ runs: with: args: --exact-timestamps env: - DEST_DIR: "rev/${{ inputs.revision }}" + DEST_DIR: "${{ inputs.shared-storage-bucket == 'true' && inputs.project-name + "/" }}rev/${{ inputs.revision }}" SOURCE_DIR: "${{ inputs.build-root }}" AWS_S3_BUCKET: ${{ inputs.storage-bucket }} AWS_S3_ENDPOINT: ${{ inputs.storage-endpoint }}