diff --git a/.github/workflows/feature-list.yml b/.github/workflows/feature-list.yml new file mode 100644 index 00000000..0cfd9ab6 --- /dev/null +++ b/.github/workflows/feature-list.yml @@ -0,0 +1,84 @@ +name: Feature List Update + +on: + schedule: + - cron: '0 0 * * *' # Run every night at midnight UTC + workflow_dispatch: + +permissions: + contents: write + actions: write + +jobs: + check-and-update-features: + runs-on: ubuntu-latest + env: + FEATURES_FILE: 'data/features.json' + + steps: + - name: Checkout current repository + uses: actions/checkout@v4 + + - name: Check for updates in source repository + id: check-updates + uses: actions/github-script@v7 + with: + script: | + const { data: sourceFile } = await github.rest.repos.getContent({ + owner: 'layer5labs', + repo: 'meshery-extensions-packages', + path: 'feature-data.json', + ref: 'master' + }); + + // Store the latest commit SHA + const latestSHA = sourceFile.sha; + + // Try to get the previously stored SHA from cache + const cache = await github.rest.actions.getActionsCacheList({ + owner: context.repo.owner, + repo: context.repo.repo, + }); + + let hasUpdates = true; + if (cache.data.actions_caches.length > 0) { + const lastSHA = cache.data.actions_caches[0].key.split('-').pop(); + hasUpdates = lastSHA !== latestSHA; + } + + if (hasUpdates) { + // Update the cache with new SHA + await github.rest.actions.createActionsCacheEntry({ + owner: context.repo.owner, + repo: context.repo.repo, + key: `feature-data-sha-${latestSHA}`, + ref: context.ref, + cache_data: latestSHA + }); + + // Decode and save the content + const content = Buffer.from(sourceFile.content, 'base64').toString('utf-8'); + const fs = require('fs'); + + // Create data directory if it doesn't exist + fs.mkdirSync('data', { recursive: true }); + + // Write the new content + fs.writeFileSync('${{ env.FEATURES_FILE }}', content); + + core.setOutput('has-updates', 'true'); + } else { + core.setOutput('has-updates', 'false'); + } + + - name: Commit changes + if: steps.check-updates.outputs.has-updates == 'true' + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "Updated feature data from source repository" + file_pattern: ${{ env.FEATURES_FILE }} + branch: master + commit_options: "--signoff" + commit_user_name: l5io + commit_user_email: ci@layer5.io + commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> \ No newline at end of file diff --git a/assets/scss/_styles_project.scss b/assets/scss/_styles_project.scss index 071759f3..279f6894 100644 --- a/assets/scss/_styles_project.scss +++ b/assets/scss/_styles_project.scss @@ -372,7 +372,7 @@ a:not([href]):not([class]):hover { .matterinfo { font-weight: $font-weight-medium; background: $black; - font-family: "Open Sans"; + font-family: "Qanelas Soft"; border-style: solid; margin: 2rem auto; padding: 1rem; diff --git a/layouts/partials/feature-info.html b/layouts/partials/feature-info.html index 901b7752..09f972fd 100644 --- a/layouts/partials/feature-info.html +++ b/layouts/partials/feature-info.html @@ -2,24 +2,56 @@ {{ $features := .Site.Data.features }} {{ if not $features }} - {{ $features = getJSON "features.json" }} +{{ $features = getJSON "features.json" }} {{ end }} {{ if $features }} +{{ $groupedFeatures := dict }} {{ range $features }} - {{ $docUrl := .documentation | default "" }} - {{ $cleanDocUrl := (index (split $docUrl "#") 0) }} - {{ if eq $cleanDocUrl $currentPage }} -
-

Who can use this feature

- {{ $subscription_tier := index .entire_row "Subscription Tier" }} -
- Icon - Supported on {{ $subscription_tier }} Plan -
-
- {{ break }} - {{ end }} +{{ $docUrl := .documentation | default "" }} +{{ $cleanDocUrl := (index (split $docUrl "#") 0) }} +{{ if eq $cleanDocUrl $currentPage }} +{{ $tier := index .entire_row "Subscription Tier" }} +{{ $feature := index .entire_row "Feature" }} +{{ $currentFeatures := index $groupedFeatures $tier | default "" }} +{{ $groupedFeatures = merge $groupedFeatures (dict $tier (printf "%s%s%s" $currentFeatures (cond (eq $currentFeatures +"") "" ", ") $feature)) }} +{{ end }} +{{ end }} + +{{ if ne (len $groupedFeatures) 0 }} +{{ $maxTier := "" }} +{{ $maxLength := 0 }} +{{ range $tier, $features := $groupedFeatures }} +{{ $length := len (split $features ", ") }} +{{ if gt $length $maxLength }} +{{ $maxTier = $tier }} +{{ $maxLength = $length }} {{ end }} {{ end }} +
+

Who can use this feature

+
+ Icon + Supported on {{ $maxTier + }} Plan +
+ + {{ if gt (len $groupedFeatures) 1 }} +
+ Add-ons: + {{ $first := true }} + {{ range $tier, $features := $groupedFeatures }} + {{ if ne $tier $maxTier }} + {{ if not $first }}, {{ end }} + {{ $first = false }} + {{ $features }} [{{ $tier + }}] + {{ end }} + {{ end }} +
+ {{ end }} +
+{{ end }} +{{ end }} \ No newline at end of file diff --git a/static/images/subscription.svg b/static/images/subscription.svg index 35ed199b..a2328859 100644 --- a/static/images/subscription.svg +++ b/static/images/subscription.svg @@ -1,4 +1,4 @@ - + \ No newline at end of file