Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: build automatizzata #147

Closed
wants to merge 12 commits into from
33 changes: 33 additions & 0 deletions .github/workflows/vademecum.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Vademecum
on: [push]

jobs:
Runningscript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Update repos
run: sudo apt update

- name: Install poppler-utils
run: sudo apt install poppler-utils

- name: Install wkhtmltopdf
run: sudo apt install xvfb libfontconfig wkhtmltopdf

- name: Making script executable
run: chmod +x scripts/build.sh

- name: Running deployment script
run: |
sh ./scripts/build.sh

- name: "Pushing to GH"
if: $? -ne 0
uses: mikeal/publish-to-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_NAME: '' #optional defaults to master


14 changes: 7 additions & 7 deletions scripts/genera_pdf_VG_VT_CV.sh → scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# this scripts takes html file converts to single pdf pages and then merges the pages
# and try to install all dependencies (tested on ubuntu and kubuntu)
# now paths are hardcoded for firefox-vademecum repository
Expand All @@ -25,7 +25,7 @@ do
echo "|| Starting conversion for "$typeLongVersion" ("$typeVersion") ||"
if ! [ -x "$(command -v wkhtmltopdf)" ]; then
if ! [ -x "$(command -v apt)" ]; then
echo "The script does not support automatic installation of wkhtmlpdf on your platform."\
echo "The script does not support automatic installation of wkhtmltopdf on your platform."\
"Please install wkhtmltopdf and then try again."
exit 1
fi
Expand All @@ -37,19 +37,19 @@ do

echo "Pdf files generating..."
echo ">> Converting $path_fronte to PDF..."
wkhtmltopdf -q -B 0 -T 0 -L 0 -R 0 $path_fronte "../volantino/pdf/"$name"_"$version"_"$typeVersion"_fronte.pdf"
wkhtmltopdf --enable-local-file-access -q -B 0 -T 0 -L 0 -R 0 $path_fronte "../volantino/pdf/"$name"_"$version"_"$typeVersion"_fronte.pdf"
echo ">> Converted $path_fronte to PDF."
echo ">> Converting $path_retro to PDF..."
wkhtmltopdf -q -B 0 -T 0 -L 0 -R 0 $path_retro "../volantino/pdf/"$name"_"$version"_"$typeVersion"_retro.pdf"
wkhtmltopdf --enable-local-file-access -q -B 0 -T 0 -L 0 -R 0 $path_retro "../volantino/pdf/"$name"_"$version"_"$typeVersion"_retro.pdf"
echo ">> Converted $path_retro to PDF."
echo "Pdf files generated."

echo "Png files generating..."
echo ">> Converting $path_fronte to PNG..."
wkhtmltoimage --crop-w 992 $path_fronte "../volantino/png/"$name"_"$version"_"$typeVersion"_fronte.png"
wkhtmltoimage --enable-local-file-access --crop-w 992 $path_fronte "../volantino/png/"$name"_"$version"_"$typeVersion"_fronte.png"
echo ">> Converted $path_fronte to PNG."
echo ">> Converting $path_retro to PNG..."
wkhtmltoimage --crop-w 992 $path_retro "../volantino/png/"$name"_"$version"_"$typeVersion"_retro.png"
wkhtmltoimage --enable-local-file-access --crop-w 992 $path_retro "../volantino/png/"$name"_"$version"_"$typeVersion"_retro.png"
echo ">> Converted $path_retro to PNG."
echo "Png files generated."

Expand All @@ -66,7 +66,7 @@ do

pdfunite "../volantino/pdf/"$name"_"$version"_"$typeVersion"_fronte.pdf" "../volantino/pdf/"$name"_"$version"_"$typeVersion"_retro.pdf" "../volantino/pdf/"$name"_"$version"_"$typeVersion".pdf"
echo "Pdf merged correctly."

echo "Temp files deleting..."
rm "../volantino/pdf/"$name"_"$version"_"$typeVersion"_fronte.pdf"
rm "../volantino/pdf/"$name"_"$version"_"$typeVersion"_retro.pdf"
Expand Down
Binary file modified volantino/pdf/Vademecum_2.0_CV.pdf
Binary file not shown.
Binary file modified volantino/pdf/Vademecum_2.0_VG.pdf
Binary file not shown.
Binary file modified volantino/pdf/Vademecum_2.0_VT.pdf
Binary file not shown.
Binary file modified volantino/png/Vademecum_2.0_CV_fronte.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified volantino/png/Vademecum_2.0_CV_retro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified volantino/png/Vademecum_2.0_VG_fronte.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified volantino/png/Vademecum_2.0_VG_retro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified volantino/png/Vademecum_2.0_VT_fronte.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified volantino/png/Vademecum_2.0_VT_retro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.