name: Ensure Site Builds Cleanly on: push: branches: [ master ] jobs: build-site: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - 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 Cache uses: actions/cache@v2 with: key: if-cache path: | ./if-cache ./if-cache.json ./twitter-cache.json - name: Install node dependencies run: npm ci - name: Lint JS code run: npm test - name: Build site run: npm run build - name: Upload Site Build uses: actions/upload-artifact@v3 with: name: site-html path: | dist 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: (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 - 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: site-pdfs path: | dist/**/*.pdf