diff --git a/.github/workflows/export-pdf.yml b/.github/workflows/build.yml similarity index 58% rename from .github/workflows/export-pdf.yml rename to .github/workflows/build.yml index b37554a..4050888 100644 --- a/.github/workflows/export-pdf.yml +++ b/.github/workflows/build.yml @@ -1,42 +1,23 @@ -name: Export PDFs - +name: Ensure Site Builds Cleanly on: - # Triggers the workflow on push or pull request events but only for the master branch push: branches: [ master ] - pull_request: - branches: [ master ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: jobs: - build: + build-site: runs-on: ubuntu-latest steps: - # Get necessary packages for this image - uses: actions/checkout@v3 - - name: Install necessary packages - run: sudo apt-get install graphicsmagick -y - # Get latest chrome - - name: Get Chrome - run: | - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb - sudo apt install ./google-chrome-stable_current_amd64.deb + - name: Install GraphicsMagick + run: sudo apt install graphicsmagick - # Check out the code - - name: Checkout - uses: actions/checkout@v3.0.0 - - # Get appropriate nodejs version - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v2 with: node-version: '14' cache: 'npm' - # Restore packages and build - name: Restore node_modules cache uses: actions/cache@v2 with: @@ -45,7 +26,7 @@ jobs: restore-keys: | ${{ runner.os }}-node_modules - - name: Restore Asset Caches + - name: Restore Asset Cache uses: actions/cache@v2 with: key: if-cache @@ -54,65 +35,76 @@ jobs: ./if-cache.json ./twitter-cache.json - - run: npm ci - - - name: Run build + - name: Install node dependencies + run: npm ci + + - name: Lint JS code + run: npm test + + - name: Build site run: npm run build - # Create a "dummy" http server inside the container - # on the output folder of the build - - name: Launch HTTP Server - uses: Eun/http-server-action@v1.0.3 + - name: Upload Site Build + uses: actions/upload-artifact@v3 with: - directory: dist + name: site-html + path: | + dist - # Launch a headless chrome instance for exporting - - name: (EN) Get PDF from HTML + + render-pdfs: + runs-on: ubuntu-latest + needs: build-site + steps: + - name: Install Chrome + run: | + wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb + sudo apt install ./google-chrome-stable_current_amd64.deb + + - name: Download site build + uses: actions/download-artifact@v3 + with: + name: site-html + + - name: (EN) Generate PDF from HTML run: | google-chrome --headless --print-to-pdf-no-header \ --run-all-compositor-stages-before-draw --print-to-pdf="./dist/en.pdf" \ http://127.0.0.1:8080/en/printable/index.html - - - name: (CN) Get PDF from HTML - run: | - google-chrome --headless --print-to-pdf-no-header \ - --run-all-compositor-stages-before-draw --print-to-pdf="./dist/cn.pdf" \ - http://127.0.0.1:8080/zh/printable/index.html - - - name: (DE) Get PDF from HTML - run: | - google-chrome --headless --print-to-pdf-no-header \ - --run-all-compositor-stages-before-draw --print-to-pdf="./dist/de.pdf" \ - http://127.0.0.1:8080/de/druckbar/index.html - - name: (HU) Get PDF from HTML - run: | - google-chrome --headless --print-to-pdf-no-header \ - --run-all-compositor-stages-before-draw --print-to-pdf="./dist/hu.pdf" \ - http://127.0.0.1:8080/hu/nyomtathato/index.html - - - name: (PL) Get PDF from HTML - run: | - google-chrome --headless --print-to-pdf-no-header \ - --run-all-compositor-stages-before-draw --print-to-pdf="./dist/pl.pdf" \ - http://127.0.0.1:8080/pl/do-druku/index.html - - - name: (ZH) Get PDF from HTML + - name: (ZH) Generate PDF from HTML run: | google-chrome --headless --print-to-pdf-no-header \ --run-all-compositor-stages-before-draw --print-to-pdf="./dist/zh.pdf" \ http://127.0.0.1:8080/zh/printable/index.html - # Something is coming soon ;) -# - name: (FR) Get PDF from HTML -# run: | -# google-chrome --headless --print-to-pdf-no-header \ -# --run-all-compositor-stages-before-draw --print-to-pdf="./dist/fr.pdf" \ -# http://127.0.0.1:8080/fr/a-imprimer/index.html - - - name: Upload PDF artifacts + - name: (DE) Generate PDF from HTML + run: | + google-chrome --headless --print-to-pdf-no-header \ + --run-all-compositor-stages-before-draw --print-to-pdf="./dist/de.pdf" \ + http://127.0.0.1:8080/de/druckbar/index.html + + - name: (HU) Generate PDF from HTML + run: | + google-chrome --headless --print-to-pdf-no-header \ + --run-all-compositor-stages-before-draw --print-to-pdf="./dist/hu.pdf" \ + http://127.0.0.1:8080/hu/nyomtathato/index.html + + - name: (PL) Generate PDF from HTML + run: | + google-chrome --headless --print-to-pdf-no-header \ + --run-all-compositor-stages-before-draw --print-to-pdf="./dist/pl.pdf" \ + http://127.0.0.1:8080/pl/do-druku/index.html + + - name: (FR) Generate PDF from HTML + run: | + google-chrome --headless --print-to-pdf-no-header \ + --run-all-compositor-stages-before-draw --print-to-pdf="./dist/fr.pdf" \ + http://127.0.0.1:8080/fr/a-imprimer/index.html + + - name: Upload PDFs uses: actions/upload-artifact@v3 with: - name: pdfs + name: site-pdfs path: | dist/**/*.pdf diff --git a/.github/workflows/ensure-build.yml b/.github/workflows/ensure-build.yml deleted file mode 100644 index 78ca546..0000000 --- a/.github/workflows/ensure-build.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Ensure Site Builds Cleanly -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2.3.5 - - name: Install GraphicsMagick - run: sudo apt install graphicsmagick - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: '14' - cache: 'npm' - - name: Restore node_modules cache - uses: actions/cache@v2 - with: - path: node_modules - key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node_modules - - name: Restore Asset Caches - uses: actions/cache@v2 - with: - key: if-cache - path: | - ./if-cache - ./if-cache.json - ./twitter-cache.json - - run: npm i - - run: npm test - - run: npm run build diff --git a/lang.yaml b/lang.yaml new file mode 100644 index 0000000..b9de6f7 --- /dev/null +++ b/lang.yaml @@ -0,0 +1,19 @@ +- lang: en + name: English (EN) + pdf-source: /en/printable/index.html?pdf=true + +- lang: fr + name: Français (FR) + pdf-source: /fr/printable/index.html?pdf=true + +- lang: hu + name: Magyar (HU) + pdf-source: /hu/nyomtathato/index.html?pdf=true + +- lang: pl + name: Polski (PL) + pdf-source: /pl/do-druku/index.html?pdf=true + +- lang: zh + name: 中文 (ZH) + pdf-source: /zh/printable/index.html?pdf=true diff --git a/public/de/_menu.hbs b/public/de/_menu.hbs index 4a55391..9df9d9b 100644 --- a/public/de/_menu.hbs +++ b/public/de/_menu.hbs @@ -2,7 +2,7 @@