Skip to content

Commit

Permalink
feat: add namespaces
Browse files Browse the repository at this point in the history
Signed-off-by: knqyf263 <[email protected]>
  • Loading branch information
knqyf263 committed May 7, 2024
1 parent 08fef04 commit 5ca0a29
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/deploy-index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Generate a list of plugins
run: |
mkdir -p site/data/v1 site/v1
cat plugins/*.yaml > site/data/plugins.yaml
run: ./ci/concat.sh site/data/plugins.yaml
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
Expand Down
27 changes: 27 additions & 0 deletions ci/concat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

output_file=$1

# Remove the output file if it exists
if [ -f "$output_file" ]; then
rm "$output_file"
fi

# Process all YAML files under the plugins directory
for file in plugins/*/*.yaml; do
# Get the directory name as the namespace
namespace=$(basename "$(dirname "$file")")

# Read the content of the YAML file, add the namespace, and append to the output file
while IFS= read -r line; do
if [[ $line == *"- name:"* ]]; then
echo "$line" >> "$output_file"
echo " namespace: $namespace" >> "$output_file"
else
echo "$line" >> "$output_file"
fi
done < "$file"

# Add a separator line between files
echo "" >> "$output_file"
done
File renamed without changes.
File renamed without changes.
Empty file added site/data/.gitkeep
Empty file.
4 changes: 2 additions & 2 deletions site/layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ <h1>{{ .Site.Title }}</h1>
</tr>
</thead>
<tbody>
{{ range .Site.Data.v1.plugins }}
{{ range .Site.Data.plugins }}
<tr>
<td><a href="{{ .repo }}" target="_blank">{{ .name }}</a></td>
<td><a href="{{ .repo }}" target="_blank">{{ .namespace }}/{{ .name }}</a></td>
<td>{{ if .type }}{{ .type }}{{ else }}generic{{ end }}</td>
<td>{{ .summary }}</td>
<td>
Expand Down

0 comments on commit 5ca0a29

Please sign in to comment.