Publish to Registry
Learn how to publish your template to CyanPrint registry
Publish to Registry
Learn how to publish your template to a CyanPrint registry for others to discover and use.
Overview
Publishing a template involves:
- Creating an account on a CyanPrint registry
- Generating an API token
- Building and pushing Docker images
- Registering the template with CyanPrint
You can use the official cyanprint.dev registry or host your own. This guide covers both options.
Prerequisites
- A completed template ready to publish
- Docker with buildx support
- CyanPrint CLI installed
Create an Account
- Navigate to cyanprint.dev
- Click Sign Up or Register
- Complete the registration process
- Verify your email address
If your organization hosts a private CyanPrint registry:
- Contact your administrator for access
- Get the registry URL (e.g.,
registry.internal.example.com) - Obtain credentials for authentication
Self-hosted registries require additional setup. See your organization's documentation for specific instructions.
Generate an API Token
- Log in to cyanprint.dev
- Navigate to Settings > API Tokens
- Click Generate New Token
- Give it a descriptive name (e.g., "CI/CD Publishing")
- Select appropriate scopes (minimum:
template:push) - Click Generate
- Copy the token immediately - it won't be shown again
# Store the token securelyexport CYAN_TOKEN="your-token-here"
Follow your organization's token generation process. Typically:
- Log in to your registry's web interface
- Navigate to API settings or profile settings
- Generate a token with push permissions
- Store it securely
# Store the token securelyexport CYAN_TOKEN="your-token-here"# If using a custom registry URLexport CYAN_REGISTRY="https://registry.internal.example.com"
Never commit API tokens to version control. Use environment variables or secret management tools.
Authenticate the CLI
Verify your CLI can authenticate with the registry:
# Test authenticationcyanprint auth status# Or manually logincyanprint login --token $CYAN_TOKEN
For self-hosted registries:
# Specify custom registrycyanprint login --token $CYAN_TOKEN --registry $CYAN_REGISTRY
Build Docker Images
Build both the template and blob images:
# Build template imagedocker buildx build --platform linux/amd64,linux/arm64 \-f cyan/template.Dockerfile \-t myorg/my-template:1.0.0 \--push .# Build blob imagedocker buildx build --platform linux/amd64,linux/arm64 \-f cyan/blob.Dockerfile \-t myorg/my-template-blob:1.0.0 \--push .
Replace myorg/my-template with your actual image name. Use Docker Hub, GHCR, or your private registry.
For GitHub Container Registry:
# Login to GHCR firstecho $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdin# Build and pushdocker buildx build --platform linux/amd64,linux/arm64 \-f cyan/template.Dockerfile \-t ghcr.io/myorg/my-template:1.0.0 \--push .
Publish to Registry
Register your template with the CyanPrint registry:
cyanprint push template --token $CYAN_TOKEN \myorg/my-template-blob 1.0.0 \myorg/my-template 1.0.0
This command:
- Registers the template metadata
- Links the blob and template images
- Makes the template discoverable
Verify Publication
Confirm your template is available:
# List your templatescyanprint list myorg/# Get template detailscyanprint info myorg/my-template:1.0.0
CI/CD Integration
Automate template publishing with GitHub Actions.
GitHub Actions Workflow
Create .github/workflows/publish.yml:
name: Publish Templateon:release:types: [published]permissions:contents: readpackages: writejobs:publish:runs-on: ubuntu-lateststeps:- uses: actions/checkout@v4- name: Set up Docker Buildxuses: docker/setup-buildx-action@v3- name: Login to GitHub Container Registryuses: docker/login-action@v3with:registry: ghcr.iousername: ${{ github.actor }}password: ${{ secrets.GITHUB_TOKEN }}- name: Extract versionid: versionrun: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT- name: Build and Push Templaterun: |docker buildx build --platform linux/amd64,linux/arm64 \-f cyan/template.Dockerfile \-t ghcr.io/${{ github.repository_owner }}/my-template:${{ steps.version.outputs.VERSION }} \--push .- name: Build and Push Blobrun: |docker buildx build --platform linux/amd64,linux/arm64 \-f cyan/blob.Dockerfile \-t ghcr.io/${{ github.repository_owner }}/my-template-blob:${{ steps.version.outputs.VERSION }} \--push .- name: Register with CyanPrintrun: |cyanprint push template --token ${{ secrets.CYAN_TOKEN }} \ghcr.io/${{ github.repository_owner }}/my-template-blob ${{ steps.version.outputs.VERSION }} \ghcr.io/${{ github.repository_owner }}/my-template ${{ steps.version.outputs.VERSION }}
Store your CYAN_TOKEN as a GitHub secret. Go to Settings > Secrets and variables > Actions > New repository secret.
Triggering the Workflow
- Create a new release in GitHub
- Tag it with a semantic version (e.g.,
v1.0.0) - The workflow automatically builds and publishes
Best Practices
Versioning
- Use semantic versioning (
MAJOR.MINOR.PATCH) - Tag both specific versions and
latest - Document breaking changes in release notes
# Build with multiple tagsdocker buildx build \-t myorg/my-template:1.0.0 \-t myorg/my-template:1.0 \-t myorg/my-template:latest \--push .
Security
- Use scoped tokens with minimum required permissions
- Rotate tokens regularly
- Never expose tokens in logs or error messages
- Use GitHub secrets or similar for CI/CD
Testing Before Publishing
Always test locally before publishing:
# Build locally without pushdocker buildx build --platform linux/amd64 \-f cyan/template.Dockerfile \-t myorg/my-template:test \--load .# Test the templatecyanprint create myorg/my-template:test ./test-output
Troubleshooting
Authentication Failed
# Verify token is setecho $CYAN_TOKEN# Check token validitycyanprint auth status
Image Not Found
# Verify images existdocker images | grep my-template# Check registry connectivitydocker pull myorg/my-template:1.0.0
Registry Unavailable
- Check registry status at status.cyanprint.dev
- Try again after a few minutes
- Contact support if the issue persists