pixelnest / presskit.html

Re-implementation of presskit() as a static site generator
http://pixelnest.io/2017/03/presskit-html/
MIT License
306 stars 51 forks source link

Building on Gitlab CI requires disabling thumbnails. #27

Open Kruemelkatze opened 3 years ago

Kruemelkatze commented 3 years ago

This is part issue, part information for others. :)

It took me quite a while to get our presskit to build on Gitlab CI. Apart from the problem that some packages seem to be outdated (no wonder, as it has not been maintained since 2019), the sharp package requires python and one of its dependencies requires make.

I got the project to build (and deploy, but that most likely will be different for most users) using this config:

image: nikolaik/python-nodejs:python3.9-nodejs14-alpine

stages:
  - setup
  - build
  - deploy

cache:
  paths:
    - node_modules/

install_dependencies:
  before_script: 
    - apk add --virtual build-dependencies build-base gcc
  stage: setup
  script:
    - npm i presskit

build_project:
  stage: build
  script:
    - npx presskit build --ignore-thumbnails
  artifacts:
    paths:
      - build/

deploy_project:
  stage: deploy
  only:
    - master
  before_script:
    - 'which ssh-agent || ( apk update && apk add openssh-client )'
    - mkdir -p ~/.ssh
    - eval $(ssh-agent -s)
    - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
    - echo "$SSH_PRIVATE_KEY" | ssh-add -
    - 'which rsync || ( apk update && apk add rsync )'
  script:
    - ls -la
    - rsync -hrvz --inplace --delete --delete-excluded build/* gitlabdeploy@HOST:/var/www/WEBSITE/presskit

However, I had to disable the thumbnail generation, as it silently failed the CI build. The runner reported a success, but no HTML files were generated:

$ npx presskit build
Starting directory: /builds/COMPANY/COMPANY-presskit
Finding data…
- company: "COMPANY" /builds/COMPANY/COMPANY-presskit/data.xml
- product: "PROJECT" /builds/COMPANY/COMPANY-presskit/PROJECT/data.xml
Generating HTML…
- "PROJECT" -> /builds/COMPANY/COMPANY-presskit/build/PROJECT/index.html
$ ls build/
PROJECT

After disabling thumbnail generation, it now runs as expected. Hope this helps anyone.

valryon commented 3 years ago

Thanks for the guide and for digging into the issue!

And while I'm here, I want to say that I cannot maintain the project (not enough time, not skilled enough in node.js), and my associate is not available either, but there's definitely a good update to be done on presskit.html... dependencies update, bug fixes, some new features, that kind of things. We're kinda stuck right now, sorry. :/

Kruemelkatze commented 3 years ago

Thank's for dropping by!

Is there any chance that you have a list of bugs and potential new features? Maybe I could invest some spare time and at least update the dependencies, do some critical fixes and provide a PR.

valryon commented 3 years ago

I think updating the whole thing (node version, dependencies, etc) + resolving the issues would already be super nice.

The #1 feature I can think of is to generate a game presskit page without requiring to have a company page. But the way the code is done right now doesn't make it very easy. Maybe a general revamp of the node side (keeping the clean rendering) would be better...