Skip to content

Commit a66773c

Browse files
authored
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
1 parent 8f78d81 commit a66773c

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed
+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
on:
2+
repository_dispatch:
3+
types: [embedded_ui_refresh]
4+
workflow_dispatch:
5+
inputs:
6+
asset_name:
7+
description: Release asset name
8+
required: true
9+
default: embedded-ui
10+
repository:
11+
description: Source repository
12+
required: true
13+
default: ydb-platform/ydb-embedded-ui
14+
tag_name:
15+
description: Release tag
16+
required: true
17+
18+
name: Embedded UI Refresh
19+
20+
jobs:
21+
main:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: write
25+
pull-requests: write
26+
env:
27+
ASSET_NAME: ${{ github.event.inputs && github.event.inputs.asset_name || github.event.client_payload.asset_name }}
28+
REPOSITORY: ${{ github.event.inputs && github.event.inputs.repository || github.event.client_payload.repository }}
29+
TAG_NAME: ${{ github.event.inputs && github.event.inputs.tag_name || github.event.client_payload.tag_name }}
30+
TEMP_ASSET_DIR: /tmp/asset
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: Asset Download
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: gh release download $TAG_NAME --repo $REPOSITORY --pattern $ASSET_NAME.zip --dir $TEMP_ASSET_DIR
37+
- name: Asset Placement
38+
env:
39+
START_POINTER: "# GENERATED MONITORING RESOURCES START"
40+
END_POINTER: "# GENERATED MONITORING RESOURCES END"
41+
TARGET_DIR: ydb/core/viewer/monitoring
42+
YA_MAKE_FILE: ydb/core/viewer/ya.make
43+
run: |
44+
unzip $TEMP_ASSET_DIR/$ASSET_NAME.zip -d $TEMP_ASSET_DIR
45+
rm -rf $TARGET_DIR
46+
mkdir $TARGET_DIR
47+
mv -vf $TEMP_ASSET_DIR/$ASSET_NAME/* $TARGET_DIR
48+
49+
# List of files in the target directory.
50+
NEW_RESOURCES=$(find $TARGET_DIR -type f | sort)
51+
52+
# Current indentation of the start pointer line.
53+
INDENTATION=$(grep -e "$START_POINTER" $YA_MAKE_FILE | perl -lane 's/^(\s+)(.*)+$/$1/e; print')
54+
55+
# Replacing resources list between start and end pointers with saving the current indentation.
56+
perl -0777 -pi -e "s/\s+$START_POINTER.*$END_POINTER/
57+
$INDENTATION$START_POINTER
58+
${INDENTATION}RESOURCE(
59+
$(echo "$NEW_RESOURCES" | perl -e "while (<>) {chomp; print \"$INDENTATION \$_ \$_\\n\";}" | sed -E 's/\//\\\//g')
60+
$INDENTATION)
61+
$INDENTATION$END_POINTER/s" $YA_MAKE_FILE
62+
- name: Pull Request
63+
uses: peter-evans/create-pull-request@v5
64+
with:
65+
token: ${{ secrets.GITHUB_TOKEN }}
66+
commit-message: "build: refresh Embedded UI (${{ env.TAG_NAME }})"
67+
branch: embedded-ui-refresh-${{ env.TAG_NAME }}
68+
delete-branch: true
69+
title: "build: refresh Embedded UI (${{ env.TAG_NAME }})"
70+
body: |
71+
### Embedded UI Refresh
72+
73+
Embedded UI
74+
[${{ env.TAG_NAME }}](https://github.com/${{ env.REPOSITORY }}/releases/tag/${{ env.TAG_NAME }})
75+
([CHANGELOG.md](https://github.com/${{ env.REPOSITORY }}/blob/${{ env.TAG_NAME }}/CHANGELOG.md)).

ydb/core/viewer/ya.make

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ SRCS(
6666
)
6767

6868
IF (NOT EXPORT_CMAKE)
69+
# GENERATED MONITORING RESOURCES START
6970
RESOURCE(
7071
monitoring/index.html monitoring/index.html
7172
monitoring/static/favicon.png monitoring/static/favicon.png
@@ -162,6 +163,7 @@ IF (NOT EXPORT_CMAKE)
162163
monitoring/static/media/error.ca9e31d5d3dc34da07e11a00f7af0842.svg monitoring/static/media/error.ca9e31d5d3dc34da07e11a00f7af0842.svg
163164
monitoring/static/media/thumbsUp.d4a03fbaa64ce85a0045bf8ba77f8e2b.svg monitoring/static/media/thumbsUp.d4a03fbaa64ce85a0045bf8ba77f8e2b.svg
164165
)
166+
# GENERATED MONITORING RESOURCES END
165167
ENDIF()
166168

167169
RESOURCE(

0 commit comments

Comments
 (0)