Local Docker Publishing Pipeline¶
You can build and publish the jekyll-theme-zer0 gem entirely inside a Docker container. This mirrors the CI release path exactly, avoiding version-skew issues caused by different host Ruby environments.
Why Run Releases in Docker?¶
| Problem | Docker solution |
|---|---|
| Host Ruby version mismatch | Container uses the same Ruby as CI |
| Polluted gem environment | Clean container discarded after run |
| "Works on my machine" | Exact CI environment reproduced locally |
| Key material leaks | Credentials injected via env vars, never stored |
Compose Files¶
| File | Purpose |
|---|---|
docker-compose.publish.yml |
Builds and pushes the Docker image to a registry |
docker-compose.prod.yml |
Production deployment with pinned image tags |
Releasing the Gem Locally¶
The recommended approach is the unified release script, which handles everything:
This script:
- Analyzes commits since the last tag to confirm the bump type
- Updates
lib/jekyll-theme-zer0/version.rb - Runs validation (
./scripts/bin/validate) - Builds the gem (
gem build jekyll-theme-zer0.gemspec) - Creates a git tag and pushes
- Publishes to RubyGems (
gem push)
Pass --dry-run to preview without publishing:
Running in a Docker Container¶
To run the release inside a Docker container manually:
# Start a clean Jekyll container
docker compose -f docker-compose.yml run --rm jekyll bash
# Inside the container:
./scripts/bin/release patch
Or with the publish compose file:
Environment Variables¶
Set credentials in .env (never commit this file):
RUBYGEMS_API_KEY=rubygems_...
GITHUB_TOKEN=ghp_...
DOCKER_IMAGE=amrabdel/zer0-mistakes
IMAGE_TAG=latest
The .env file is already in .gitignore.
CI Pipeline Equivalent¶
GitHub Actions runs the same release pipeline automatically on version tags:
# .github/workflows/release.yml (simplified)
- name: Build gem
run: gem build jekyll-theme-zer0.gemspec
- name: Publish to RubyGems
run: gem push jekyll-theme-zer0-${{ env.VERSION }}.gem
env:
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
Troubleshooting¶
"Invalid API key"¶
Set RUBYGEMS_API_KEY in your shell or .env file:
Gem already published at that version¶
Bump the version and re-run. RubyGems does not allow overwriting a published version.
Docker build fails¶
Related¶
See also¶
- [[Development]]
- [[Docker]]
- [[Release Management]]