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

Gitlab CI + Gitlab Pages #45

Open
noraj opened this issue Jun 21, 2021 · 5 comments · May be fixed by #49
Open

Gitlab CI + Gitlab Pages #45

noraj opened this issue Jun 21, 2021 · 5 comments · May be fixed by #49

Comments

@noraj
Copy link
Contributor

noraj commented Jun 21, 2021

You wrote a Github Actions + Github pages deploy page. I'd like to PR one for Gitlab CI + Gitlab Pages.

A simple naive CI gitlab-ci.yml:

image: node:lts-alpine

before_script:
  - npm install --global retypeapp # https://retype.com/guides/getting-started/

pages:
  script:
  - retype build
  - mv site public
  artifacts:
    paths:
    - public
  only:
  - master

I'll PR when I'll have fixed this error:

$ retype build
events.js:352
      throw er; // Unhandled 'error' event
      ^
Error: spawn /usr/local/lib/node_modules/retypeapp/platforms/linux-x64/retype ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /usr/local/lib/node_modules/retypeapp/platforms/linux-x64/retype',
  path: '/usr/local/lib/node_modules/retypeapp/platforms/linux-x64/retype',
  spawnargs: [ 'build' ]
}
@noraj noraj linked a pull request Jun 21, 2021 that will close this issue
@justerhan
Copy link

justerhan commented Jul 16, 2021

Here's an example of mine deploying to Netlify:
Config and project info lives in root folder of repo, docs is where the retype files are in my setup. The system uses ENV vars for deployment info and auto-publishes on commits to master.

image: node:12

# All jobs per branch will use this cache
# More info: https://docs.gitlab.com/ee/ci/caching/
cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
  - node_modules/

before_script:
  - node --version

stages:
  - deploy

deploy:
  stage: deploy
  environment:
    name: docs
    url: https://docs.example.com
  only:
    - master
  script:
    - npm install retypeapp
    - npm install netlify-cli
    - (cd ./docs && npx retype build)
    - npx netlify deploy --site $NETLIFY_SITE_ID --auth $NETLIFY_AUTH_TOKEN --dir ./docs/.retype --prod

@nielsvz
Copy link

nielsvz commented Jan 20, 2022

You wrote a Github Actions + Github pages deploy page. I'd like to PR one for Gitlab CI + Gitlab Pages.

A simple naive CI gitlab-ci.yml:

image: node:lts-alpine

before_script:
  - npm install --global retypeapp # https://retype.com/guides/getting-started/

pages:
  script:
  - retype build
  - mv site public
  artifacts:
    paths:
    - public
  only:
  - master

I'll PR when I'll have fixed this error:

$ retype build
events.js:352
      throw er; // Unhandled 'error' event
      ^
Error: spawn /usr/local/lib/node_modules/retypeapp/platforms/linux-x64/retype ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /usr/local/lib/node_modules/retypeapp/platforms/linux-x64/retype',
  path: '/usr/local/lib/node_modules/retypeapp/platforms/linux-x64/retype',
  spawnargs: [ 'build' ]
}

This works for us by switching to the full node image from the alpine one.

@geoffreymcgill
Copy link
Contributor

Hi @nielsvz. Would you mind sharing your Retype Gitlab CI .yml config file?

We can create an official page in the docs for GitLab.

@nielsvz
Copy link

nielsvz commented Jan 20, 2022

Here is what I did to get this to work, this will publish the output to GitLab Pages when running in the default branch of the repository.

.gitlab-ci.yml

---
stages:
  - build

pages:
  stage: build
  image: node:lts
  before_script:
    - npm install --global retypeapp
  script:
    - 'retype build --override "{ \"url\": \"$CI_PAGES_URL\" }" --output $CI_PROJECT_DIR/public'
  artifacts:
    paths:
      - public
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

Ensure you set the output directory to ./public and update url to match the GitLab Pages documentation. You can do this automatically by leveraging the --override and --output options.

An example project can be found on GitLab.com here, the built website can be reached here

@noraj
Copy link
Contributor Author

noraj commented Jan 20, 2022

This works for us by switching to the full node image from the alpine one.

Yep I forgot to say I hade to move to an heavier image (base on debian instead of alpine)

-image: node:lts-alpine
+image: node:lts-buster
image: node:lts-buster # https://hub.docker.com/_/node

before_script:
  - node --version
  - npm install --global retypeapp # https://retype.com/guides/getting-started/

pages:
  script:
  - retype build
  - mv site public
  artifacts:
    paths:
    - public
  only:
  - master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants