Skip to content

Commit

Permalink
Feat: Sécurisation du processus de publication
Browse files Browse the repository at this point in the history
La publication ne nécessite plus d'utiliser les web services Sparna.

Les outils sont téléchargés depuis GitHub pour être utilisés depuis les
GitHub actions et depuis le Dockerfile.
  • Loading branch information
eonm-pro committed Oct 2, 2023
1 parent 5f35564 commit d6bd48b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 31 deletions.
33 changes: 15 additions & 18 deletions .github/workflows/google-sheet-to-ttl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Récupération de l'ontologie"
- name: "Récupération de xls2rdf"
run: |
curl -L --request GET 'https://github.com/sparna-git/xls2rdf/releases/download/2.2.0/xls2rdf-app-2.2.0-onejar.jar' \
-o ./xls2rdf.jar
- name: "Récupération des données de l'ontologie"
run: |
curl -L --request GET 'https://docs.google.com/spreadsheets/d/1CZIf3bxuuH3aghFn7B7P89DrLqp_jzv4moI_BpI9PzY/export?format=xlsx' \
-o data.xlsx
- name: "Transformation de l'ontologie au format RDF"
run : |
curl -L --request GET 'https://xls2rdf.sparna.fr/rest/convert?noPostProcessings=true' \
-H "Connection: keep-alive" \
-F url='https://docs.google.com/spreadsheets/d/1CZIf3bxuuH3aghFn7B7P89DrLqp_jzv4moI_BpI9PzY/export?format=xlsx' \
-F format=ttl \
-o ./ontologie/rdafr.ttl
curl -L --request GET 'https://xls2rdf.sparna.fr/rest/convert?noPostProcessings=true' \
-H "Connection: keep-alive" \
-F url='https://docs.google.com/spreadsheets/d/1CZIf3bxuuH3aghFn7B7P89DrLqp_jzv4moI_BpI9PzY/export?format=xlsx' \
-F format=text/plain \
-o ./ontologie/rdafr.nt
curl -L --request GET 'https://xls2rdf.sparna.fr/rest/convert?noPostProcessings=true' \
-H "Connection: keep-alive" \
-F url='https://docs.google.com/spreadsheets/d/1CZIf3bxuuH3aghFn7B7P89DrLqp_jzv4moI_BpI9PzY/export?format=xlsx' \
-F format=application/rdf+xml \
-o ./ontologie/rdafr.rdf
java -jar xls2rdf.jar convert -i data.xlsx -o ./ontologie/data.nt -np -l fr -f text/plain
java -jar xls2rdf.jar convert -i data.xlsx -o ./ontologie/data.ttl -np -l fr -f ttl
java -jar xls2rdf.jar convert -i data.xlsx -o ./ontologie/data.rdf -np -l fr -f application/rdf+xml
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Feat : Mise à jour de l'ontologie"
file_pattern: "ontologie/*.*"
20 changes: 7 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ FROM debian:stable-20230502-slim AS builder
# locales : pour avoir les dates en français auto-générées par l'outil pandoc dans footer.html
# pandoc : l'outil pour générer les contenus html du site web à partir des fichiers markdown
# default-jdk : pour pouvoir utiliser l'outil widoco (qui est un outil en java) utilisé pour générer l'ontologie en HTML
# curl : pour faire des appels aux webservices de Sparna (génération des fichiers TTL et NT) et l'installation de Widoco
# curl : pour installer les outils de Sparna (génération des fichiers TTL et NT) et Widoco depuis GitHub.

RUN apt update && DEBIAN_FRONTEND=noninteractive apt -y install locales pandoc default-jdk curl

# Installation de Widoco

RUN curl -L https://github.com/dgarijo/Widoco/releases/download/v1.4.19/widoco-1.4.19-jar-with-dependencies_JDK-17.jar -o /tmp/widoco.jar

RUN mkdir /build/
Expand All @@ -21,7 +20,6 @@ RUN mkdir -p /tmp/ontologie
COPY ./ontologie/ /tmp/ontologie/

# Configuration des locales en français pour avoir une génération de date en français

RUN sed -i '/fr_FR.UTF-8/s/^# //g' /etc/locale.gen && \
locale-gen
ENV LANG fr_FR.UTF-8
Expand All @@ -31,7 +29,6 @@ ENV LC_ALL fr_FR.UTF-8
WORKDIR /build/

# Génération du site web

RUN sed -i "s#LAST_MODIFICATION_DATE_PLACEHOLDER#$(date +'%e %B %Y')#g" /build/footer.html

RUN pandoc /build/index-intro.md -o /build/intro.html
Expand All @@ -53,7 +50,6 @@ RUN pandoc --standalone \
/build/release-notes.md -o /build/release-notes.html

# Génération de la documentation de l'ontologie

RUN mkdir -p ontologie

# Ajout des métadonnées à l'ontologie. On rajoute les métadonnées à la fin. Widoco prend les dernières en cas de répétition
Expand All @@ -74,21 +70,19 @@ RUN java -jar /tmp/widoco.jar \
RUN mv /build/ontologie/index-en.html /build/ontologie/index.html

# Génération du profil d'application

RUN mkdir -p profil-application

# Ajout des métadonnées au profil d'application. On copie les métadonnées au format NT dans le fichier TTL, pour faire apparaître les préfix dans le profil d'application
RUN cat /tmp/ontologie/profil-application-metadata.nt /tmp/ontologie/rdafr.ttl > /tmp/ontologie/profil-application-avec-meta.ttl

RUN curl -F inputShapeFile=@/tmp/ontologie/profil-application-avec-meta.ttl \
-F shapesSource=file \
-F language=fr \
-H 'Accept-Language: fr-FR,fr' \
https://shacl-play.sparna.fr/play/doc \
> /build/profil-application/index.html
# Installation de shacl play
RUN curl -L https://github.com/sparna-git/shacl-play/releases/download/0.7.0/shacl-play-app-0.7.0-onejar.jar \
-o shacl-play.jar

# Post traitement du profil d'application
# Génération du profil d'application
RUN java -jar shacl-play.jar doc -i /tmp/ontologie/profil-application-avec-meta.ttl -o /build/profil-application/index.html -l fr

# Post traitement du profil d'application
RUN sed -E -i /build/profil-application/index.html \
-e 's#<a href="(https://rdafr\.fr/Elements.*?/)" target="_blank">.*?</a>#\1#' \
-e 's#<a href="https://rdafr\.fr/(Elements|termList).*?>(.*?)</a>#\2#'
Expand Down

0 comments on commit d6bd48b

Please sign in to comment.