From a2dbca0ed4b55a8d8a790fde711ce5e75633b767 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Tue, 13 Jun 2023 10:56:52 +0300 Subject: [PATCH] chore(ci): add screenshots generation (#9582) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [ ] ⚖️ My code follows the style guidelines of this project - [ ] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [ ] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --- .github/scripts/build-catalog.sh | 12 ++++++++++++ .github/workflows/charts-release.yaml | 1 + 2 files changed, 13 insertions(+) diff --git a/.github/scripts/build-catalog.sh b/.github/scripts/build-catalog.sh index 450e8750ec3..340feeabf87 100755 --- a/.github/scripts/build-catalog.sh +++ b/.github/scripts/build-catalog.sh @@ -75,6 +75,18 @@ patch_apps() { sed -i "s|^icon:|icon_url:|g" catalog/${train}/${chartname}/item.yaml echo "categories:" >> catalog/${train}/${chartname}/item.yaml cat ${target}/Chart.yaml | yq '.annotations."truecharts.org/catagories"' -r >> catalog/${train}/${chartname}/item.yaml + + # Generate screenshots + screenshots=$(ls ${target}/screenshots) + if [[ -n $screenshots ]]; then + echo "screenshots:" >> catalog/${train}/${chartname}/item.yaml + for screenshot in $screenshots; do + echo " - https://truecharts.org/img/hotlink-ok/chart-screenshots/${chartname}/${screenshot}" >> catalog/${train}/${chartname}/item.yaml + done + else + echo "screenshots: []" >> catalog/${train}/${chartname}/item.yaml + fi + rm -rf ${target}/screenshots # Copy changelog from website if [[ ! -f "website/docs/charts/${train}/${chartname}/CHANGELOG.md" ]]; then touch "website/docs/charts/${train}/${chartname}/CHANGELOG.md" diff --git a/.github/workflows/charts-release.yaml b/.github/workflows/charts-release.yaml index 5ae57ade2f7..74d3cd9253f 100644 --- a/.github/workflows/charts-release.yaml +++ b/.github/workflows/charts-release.yaml @@ -184,6 +184,7 @@ jobs: mkdir -p website/docs/charts/${train}/${chart} || echo "chart path already exists, continuing..." yes | cp -rf charts/${train}/${chart}/docs/* website/docs/charts/${train}/${chart}/ 2>/dev/null || : yes | cp -rf charts/${train}/${chart}/icon.png website/static/img/hotlink-ok/chart-icons/${chart}.png 2>/dev/null || : + yes | cp -rf charts/${train}/${chart}/screenshots/* website/static/img/hotlink-ok/chart-screenshots/${chart}/ 2>/dev/null || : # Copy over kept documents mv -f tmp/website/docs/charts/${train}/${chart}/CHANGELOG.md website/docs/charts/${train}/${chart}/CHANGELOG.md 2>/dev/null || :