aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Lewandowski <me@vovaspace.com>2024-01-29 13:09:36 +0100
committerGitHub <noreply@github.com>2024-01-29 15:09:36 +0300
commita66773cb8a2692d6fb523a467111b23e0c5f8787 (patch)
tree745a2c75fb6865a263ebdccb19ada7ac91b83bc6
parent8f78d817ca887fee2bf4128eba17ae323b4b81e0 (diff)
downloadydb-a66773cb8a2692d6fb523a467111b23e0c5f8787.tar.gz
build: add a CI flow for Embedded UI refresh (#1321)
* build: add a CI flow for Embedded UI refresh * ci: add comments to Embedded UI refresh script * ci: remove unnecessary `.map` files filter in Embedded UI refresh script
-rw-r--r--.github/workflows/embedded_ui_refresh.yaml75
-rw-r--r--ydb/core/viewer/ya.make2
2 files changed, 77 insertions, 0 deletions
diff --git a/.github/workflows/embedded_ui_refresh.yaml b/.github/workflows/embedded_ui_refresh.yaml
new file mode 100644
index 0000000000..d7cf2f073e
--- /dev/null
+++ b/.github/workflows/embedded_ui_refresh.yaml
@@ -0,0 +1,75 @@
+on:
+ repository_dispatch:
+ types: [embedded_ui_refresh]
+ workflow_dispatch:
+ inputs:
+ asset_name:
+ description: Release asset name
+ required: true
+ default: embedded-ui
+ repository:
+ description: Source repository
+ required: true
+ default: ydb-platform/ydb-embedded-ui
+ tag_name:
+ description: Release tag
+ required: true
+
+name: Embedded UI Refresh
+
+jobs:
+ main:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ pull-requests: write
+ env:
+ ASSET_NAME: ${{ github.event.inputs && github.event.inputs.asset_name || github.event.client_payload.asset_name }}
+ REPOSITORY: ${{ github.event.inputs && github.event.inputs.repository || github.event.client_payload.repository }}
+ TAG_NAME: ${{ github.event.inputs && github.event.inputs.tag_name || github.event.client_payload.tag_name }}
+ TEMP_ASSET_DIR: /tmp/asset
+ steps:
+ - uses: actions/checkout@v4
+ - name: Asset Download
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: gh release download $TAG_NAME --repo $REPOSITORY --pattern $ASSET_NAME.zip --dir $TEMP_ASSET_DIR
+ - name: Asset Placement
+ env:
+ START_POINTER: "# GENERATED MONITORING RESOURCES START"
+ END_POINTER: "# GENERATED MONITORING RESOURCES END"
+ TARGET_DIR: ydb/core/viewer/monitoring
+ YA_MAKE_FILE: ydb/core/viewer/ya.make
+ run: |
+ unzip $TEMP_ASSET_DIR/$ASSET_NAME.zip -d $TEMP_ASSET_DIR
+ rm -rf $TARGET_DIR
+ mkdir $TARGET_DIR
+ mv -vf $TEMP_ASSET_DIR/$ASSET_NAME/* $TARGET_DIR
+
+ # List of files in the target directory.
+ NEW_RESOURCES=$(find $TARGET_DIR -type f | sort)
+
+ # Current indentation of the start pointer line.
+ INDENTATION=$(grep -e "$START_POINTER" $YA_MAKE_FILE | perl -lane 's/^(\s+)(.*)+$/$1/e; print')
+
+ # Replacing resources list between start and end pointers with saving the current indentation.
+ perl -0777 -pi -e "s/\s+$START_POINTER.*$END_POINTER/
+ $INDENTATION$START_POINTER
+ ${INDENTATION}RESOURCE(
+ $(echo "$NEW_RESOURCES" | perl -e "while (<>) {chomp; print \"$INDENTATION \$_ \$_\\n\";}" | sed -E 's/\//\\\//g')
+ $INDENTATION)
+ $INDENTATION$END_POINTER/s" $YA_MAKE_FILE
+ - name: Pull Request
+ uses: peter-evans/create-pull-request@v5
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ commit-message: "build: refresh Embedded UI (${{ env.TAG_NAME }})"
+ branch: embedded-ui-refresh-${{ env.TAG_NAME }}
+ delete-branch: true
+ title: "build: refresh Embedded UI (${{ env.TAG_NAME }})"
+ body: |
+ ### Embedded UI Refresh
+
+ Embedded UI
+ [${{ env.TAG_NAME }}](https://github.com/${{ env.REPOSITORY }}/releases/tag/${{ env.TAG_NAME }})
+ ([CHANGELOG.md](https://github.com/${{ env.REPOSITORY }}/blob/${{ env.TAG_NAME }}/CHANGELOG.md)).
diff --git a/ydb/core/viewer/ya.make b/ydb/core/viewer/ya.make
index 6ba7460f81..6041359303 100644
--- a/ydb/core/viewer/ya.make
+++ b/ydb/core/viewer/ya.make
@@ -66,6 +66,7 @@ SRCS(
)
IF (NOT EXPORT_CMAKE)
+ # GENERATED MONITORING RESOURCES START
RESOURCE(
monitoring/index.html monitoring/index.html
monitoring/static/favicon.png monitoring/static/favicon.png
@@ -162,6 +163,7 @@ IF (NOT EXPORT_CMAKE)
monitoring/static/media/error.ca9e31d5d3dc34da07e11a00f7af0842.svg monitoring/static/media/error.ca9e31d5d3dc34da07e11a00f7af0842.svg
monitoring/static/media/thumbsUp.d4a03fbaa64ce85a0045bf8ba77f8e2b.svg monitoring/static/media/thumbsUp.d4a03fbaa64ce85a0045bf8ba77f8e2b.svg
)
+ # GENERATED MONITORING RESOURCES END
ENDIF()
RESOURCE(