Skip to content

Commit 477e458

Browse files
committed
pbek/QOwnNotes#2772 add: workflow to generate script metadata index
1 parent a3618b1 commit 477e458

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

.github/workflows/generate-index.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Generate script metadata index
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Generate index
13+
run: ./.github/workflows/scripts/generate-index.sh
14+
- name: Upload index.json
15+
run: |
16+
gh release upload metadata-index index.json --clobber --repo "$GITHUB_REPOSITORY"
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
#!/bin/env bash
2+
#
3+
# Generate index of all script metadata
4+
#
25

3-
echo "[" >> concatenated_info.json
6+
FILE_NAME=index.json
7+
8+
echo "[" >> ${FILE_NAME}
49

510
# Search for all files named "info.json" and store their paths in an array
611
files=( $(find . -name "info.json") )
712

813
# Loop through the array of files and concatenate their contents into a new file
914
for (( i=0; i<${#files[@]}; i++ ))
1015
do
11-
cat "${files[i]}" >> concatenated_info.json
16+
cat "${files[i]}" >> ${FILE_NAME}
1217
if [ $i -ne $((${#files[@]}-1)) ]
1318
then
14-
echo "," >> concatenated_info.json
19+
echo "," >> ${FILE_NAME}
1520
fi
1621
done
1722

18-
echo "]" >> concatenated_info.json
19-
20-
echo "Done! Concatenated info.json files can be found in concatenated_info.json."
23+
echo "]" >> ${FILE_NAME}
2124

25+
echo "Done! Concatenated info.json files can be found in ${FILE_NAME}."

0 commit comments

Comments
 (0)