Generate Bundle #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Zip Files and Upload Artifact | |
on: | |
workflow_dispatch: | |
env: | |
# ToDo: read from yaml list of all schemas (how to handle RC-REF with no examples, cf '|| true' below) | |
SCHEMAS: "RC-EDA RS-EDA EMSI GEO-POS GEO-REQ GEO-RES RC-REF RS-ERROR RS-RI RS-DR RS-RR RPIS RS-EDA-MAJ RS-SR" | |
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" | |
IFS=' ' read -ra SCHEMAS_ARRAY <<< "$SCHEMAS" | |
for SCHEMA in "${SCHEMAS_ARRAY[@]}"; do | |
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: RC-REF and RS-ERROR | |
# 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.docx" | |
done | |
- 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 |