-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (55 loc) · 2.26 KB
/
generate-bundle.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Generate Bundle
on:
workflow_dispatch:
jobs:
zip_and_upload:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up zip
run: sudo apt-get install zip -y
- name: Create bundle folder
run: |
rm -r bundle || true
mkdir bundle
# Nomenclatures
mkdir "bundle/Annexes - Nomenclatures"
cp -r nomenclature_parser/out/latest/* "bundle/Annexes - Nomenclatures/"
# Modèles
messagesDir="bundle/Annexes - Messages"
mkdir "$messagesDir"
# Read schemas from yaml file
while IFS= read -r line || [ -n "$line" ]; do
if [[ $line =~ ^[[:space:]]*schema:[[:space:]]*([^[:space:]]*) ]]; then
SCHEMA="${BASH_REMATCH[1]}"
# Skip schemas that don't need to be included
if [ "$SCHEMA" = "TECHNICAL" ] || [ "$SCHEMA" = "TECHNICAL_NOREQ" ] || [ "$SCHEMA" = "customContent" ]; then
echo "Skipping $SCHEMA"
continue
fi
echo $SCHEMA
# Create "Annexes" directory
schemaDir="$messagesDir/Annexes $SCHEMA"
mkdir "$schemaDir"
# Create and populate "Schemas et Exemples" directory
mkdir "$schemaDir/Schemas et Exemples"
cp src/main/resources/json-schema/$SCHEMA.schema.json "$schemaDir/Schemas et Exemples"
cp src/main/resources/xsd/$SCHEMA.xsd "$schemaDir/Schemas et Exemples"
cp src/main/resources/sample/examples/$SCHEMA/* "$schemaDir/Schemas et Exemples" || true # || true as not all schemas have examples
# Populate root elements (docx and UML)
cp csv_parser/out/$SCHEMA/$SCHEMA.schema.docx "$schemaDir/Annexe au DSF - $SCHEMA.docx"
cp csv_parser/out/$SCHEMA/$SCHEMA.uml_diagram.pdf "$schemaDir/Schema UML - $SCHEMA.pdf"
fi
done < csv_parser/out/schemas.yaml
- name: Create zip file with date
run: |
currentDate=$(date +'%y.%m.%d')
bundle_name="${currentDate}_DSF_Hub Sante"
mv bundle "$bundle_name"
zip -r bundle.zip "$bundle_name"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Bundle-zip
path: bundle.zip