Open noraj opened 3 years ago
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
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.
Hi @nielsvz. Would you mind sharing your Retype Gitlab CI .yml
config file?
We can create an official page in the docs for GitLab.
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
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
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
:I'll PR when I'll have fixed this error: