Deployment Guide
This guide explains how to configure and deploy the Jodit Connector package.
GitHub Repository Setup
1. Enable GitHub Pages
For automatic documentation deployment:
- Go to your repository Settings → Pages
- Under "Build and deployment":
- Source: Select "GitHub Actions"
- Save the changes
The documentation will be automatically deployed to https://<username>.github.io/<repository>/
on every push to main
that changes source files.
2. Configure Secrets
For automated publishing to npm and DockerHub, add the following secrets in Settings → Secrets and variables → Actions:
Required Secrets:
- NPM_TOKEN - npm automation token ```bash # Create token npm login npm token create --type=automation
# Copy the token and add it to GitHub secrets ```
-
DOCKERHUB_USERNAME - Your DockerHub username
bash # Example: johndoe
-
DOCKERHUB_TOKEN - DockerHub access token
bash # Create at: https://hub.docker.com/settings/security # Click "New Access Token" # Copy the token and add it to GitHub secrets
Release Process
Automated Release
- Update version in
package.json
:bash npm run newversion # Increments patch version, commits, and tags
Or manually:
bash
npm version patch # or minor, major
-
Push the tag to trigger automated release:
bash git push --tags origin HEAD:main
-
GitHub Actions will automatically:
- ✅ Run tests and linter
- ✅ Build Docker image
- ✅ Push Docker image to DockerHub as
latest
and<version>
- ✅ Publish package to npm registry with provenance
Manual Release
If you prefer manual releases:
-
Build the package:
bash npm run build
-
Publish to npm:
bash npm publish
-
Build and push Docker image:
bash docker build -t <username>/jodit-nodejs:latest . docker push <username>/jodit-nodejs:latest
Workflows Overview
connector.yml
- Main CI/CD Pipeline
Triggers:
- Push to main
branch
- Pull requests to main
- Tags (e.g., v1.0.0
)
Jobs:
- test
- Runs linter, tests, and build
- docker
- Builds and pushes Docker image (tags only)
- publish
- Publishes to npm (tags only)
docs.yml
- Documentation Deployment
Triggers:
- Push to main
(if source files changed)
- Manual trigger (Actions tab)
Jobs:
- build
- Generates OpenAPI documentation
- deploy
- Deploys to GitHub Pages
Docker Deployment
Pull from DockerHub
docker pull <username>/jodit-nodejs:latest
Run with Docker
# Basic run
docker run -p 8081:8081 <username>/jodit-nodejs:latest
# With custom config
docker run -p 8081:8081 \
-v /path/to/config.json:/usr/src/app/config.json \
-v /path/to/files:/usr/src/app/files \
<username>/jodit-nodejs:latest
# With environment variables
docker run -p 8081:8081 \
-e SOURCE_ROOT=/data \
-e SOURCE_BASEURL=https://cdn.example.com/ \
<username>/jodit-nodejs:latest
NPM Package Usage
Install
npm install jodit-nodejs
Basic Usage
const { start } = require('jodit-nodejs');
start({
port: 8081,
config: {
sources: {
uploads: {
title: 'Uploads',
root: '/path/to/files',
baseurl: 'http://localhost:8080/files/'
}
}
}
});
Troubleshooting
Documentation not deploying
- Check GitHub Pages is enabled in Settings → Pages
- Verify workflow ran successfully in Actions tab
- Check workflow logs for errors
- Ensure
docs/
directory is generated correctly locally
npm publish fails
- Verify
NPM_TOKEN
is set correctly in GitHub secrets - Check token has publish permissions
- Ensure package name is available on npm registry
- Check package.json version is incremented
Docker push fails
- Verify
DOCKERHUB_USERNAME
andDOCKERHUB_TOKEN
are set correctly - Check DockerHub repository exists
- Verify token has push permissions
- Check Docker image builds successfully locally
Support
For issues and questions: - GitHub Issues: https://github.com/jodit/jodit-nodejs/issues - Documentation: https://jodit.github.io/jodit-nodejs/