Skip to content

Commit f17c6e6

Browse files
committed
refactor: split AWS AMI metadata MD and CSV files per AlmaLinux release
- add the script to merge several MD and CSV files - call the script on documentation "prebuild"
1 parent 89326d5 commit f17c6e6

File tree

10 files changed

+404
-380
lines changed

10 files changed

+404
-380
lines changed

aws_amis_md_csv_merge.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# description: Merge multiple AWS AMI metadata CSV ad MD files into one.
4+
#
5+
# All docs/cloud/AWS_AMIS_*.md are merged into docs/cloud/AWS_AMIS.md
6+
# All docs/.vuepress/public/ci-data/aws_amis_*.csv are merged into docs/.vuepress/public/ci-data/aws_amis.csv
7+
#
8+
# In both cases, AlmaLinux newer versions go first, and the files are merged in descending order.
9+
# The MD files are merged by skipping the header line in all but the first file.
10+
11+
# Merge csv files: just concatenate them
12+
csv_data_dir="docs/.vuepress/public/ci-data"
13+
cat ${csv_data_dir}/aws_amis_{10..8}.csv > ${csv_data_dir}/aws_amis.csv
14+
15+
# Merge md files: first one is taking all the lines, and the rest are skipping the header 2 lines
16+
md_data_dir="docs/cloud"
17+
( cat ${md_data_dir}/AWS_AMIS_10.md; tail -q -n +3 ${md_data_dir}/AWS_AMIS_{9..8}.md ) > ${md_data_dir}/AWS_AMIS.md
18+
# Make the md file prettier
19+
npx prettier --parser markdown --write ${md_data_dir}/AWS_AMIS.md

docs/.vuepress/public/ci-data/aws_amis.csv

Lines changed: 0 additions & 188 deletions
This file was deleted.

0 commit comments

Comments
 (0)