From 62e16721967c8d54619c5728113839ce1e6ebd89 Mon Sep 17 00:00:00 2001 From: "Andreas Goelzer (NuoDB)" <139239314+agoelzer@users.noreply.github.com> Date: Mon, 2 Dec 2024 06:02:51 -0500 Subject: [PATCH] save built WebUI static files into gh-pages repo (#41) --- .github/workflows/build.yaml | 15 ++++----------- build_utils.sh | 6 ++++++ docker/production/files/entrypoint.sh | 7 +++++++ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b59165c..8413e70 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -5,12 +5,14 @@ on: - "main" - "rel/*" jobs: - publish_docker_image: - name: Publish Docker Image + publish_docker_image_and_helm: + name: Publish Docker Image and helm charts runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Install JDK 17 uses: actions/setup-java@v4 with: @@ -45,15 +47,6 @@ jobs: name: test-results path: selenium-tests/target/test-results retention-days: 7 - - publish_helm_chart: - name: Publish Helm Chart - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Configure Git run: | git config user.name "$GITHUB_ACTOR" diff --git a/build_utils.sh b/build_utils.sh index 8f6127e..24f650b 100755 --- a/build_utils.sh +++ b/build_utils.sh @@ -111,6 +111,11 @@ if [ "$1" == "createHelmPackage" ] ; then (cd build/charts && helm package ${REPOSITORY}) cat ${CHART_FILE} | sed "s/^version: .*/version: \"${VERSION}-latest\"/g" > build/${CHART_FILE} (cd build/charts && helm package ${REPOSITORY}) + + echo "Create tgz file from static files" + mkdir -p build/static_files + docker run nuodbaas-webui tgz_static > build/static_files/${REPOSITORY}-html-${SNAPSHOT}.tgz + cp build/static_files/${REPOSITORY}-html-${SNAPSHOT}.tgz build/static_files/${REPOSITORY}-html-${VERSION}-latest.tgz exit 0 fi @@ -142,6 +147,7 @@ if [ "$1" == "uploadHelmPackage" ] ; then # Update index with new Helm charts mv build/charts/*.tgz ./ helm repo index . + mv static_files/*.tgz ./ git add index.yaml *.tgz git commit -m "Add chart ${NEW_CHART} to index" diff --git a/docker/production/files/entrypoint.sh b/docker/production/files/entrypoint.sh index 9b4e65c..ec8ab36 100755 --- a/docker/production/files/entrypoint.sh +++ b/docker/production/files/entrypoint.sh @@ -1,6 +1,13 @@ #!/bin/sh # (C) Copyright 2024 Dassault Systemes SE. All Rights Reserved. +if [ "$1" == "tgz_static" ] ; then + echo "Exctract static files from image" + cd /usr/share/nginx/html + tar -czf - -C /usr/share/nginx/html * + exit $? +fi + if [ "${NUODB_CP_REST_URL}" != "" ] ; then find /usr/share/nginx/html -type f | while read line; do sed -i "s#___NUODB_CP_REST_URL___#${NUODB_CP_REST_URL}#g" ${line}