CI/CD Deployment Pipeline¶
Overview¶
This project uses GitHub Actions to automatically build, test, deploy to GitHub
Pages, and create releases on every commit to the main branch.
Workflow Jobs¶
1. Build & Lint¶
Runs initial checks and builds the application:
- Checks out code with full history
- Sets up pnpm 9.x and Node.js 20 with dependency caching
- Installs dependencies with
pnpm install --frozen-lockfile - Runs markdown linting:
pnpm dlx markdownlint-cli2 - Runs code linting:
pnpm lint - Builds site:
pnpm build - Builds documentation with
ghcr.io/tiogars/mkdocs-docker-imageintosite_output/, then copies it todist/docs/ - Automatically bumps PATCH version
- Commits and pushes version changes to
main
Outputs:
version: Semantic version string (e.g.,0.1.2)version-tag: Git tag (e.g.,v0.1.2)
2. Deploy¶
Deploys built site to GitHub Pages:
- Downloads build artifacts
- Configures GitHub Pages settings
- Uploads artifacts to Pages
- Deploys using
actions/deploy-pages@v4
Environment: GitHub Pages with OIDC token authentication
Deployment URL: Available as steps.deployment.outputs.page_url
3. Release¶
Creates GitHub Release with versioned archive:
- Downloads build artifacts
- Creates ZIP archive of built site
- Creates GitHub Release with tag
vX.Y.Z - Uploads ZIP file as release asset
- Generates automated release notes
Release Contains:
- Version tag
vX.Y.Z - Automated changelog
calendar-X.Y.Z.ziparchive
Version Management¶
Semantic Versioning¶
The project uses semantic versioning: MAJOR.MINOR.PATCH
Strategy:
- Each commit to
mainautomatically increments PATCH version - Manual version bumps can be made by editing the
VERSIONfile package.jsonis automatically kept in sync
Version File: ./VERSION (root of repository)
How Versioning Works¶
- Workflow reads current version from
VERSIONfile - Increments PATCH component (e.g.,
0.0.0→0.0.1) - Updates both
VERSIONandpackage.json - Commits changes with automated message:
chore: bump version to X.Y.Z - Pushes commits to
main(will trigger another workflow run)
Manual Version Control¶
To bump MAJOR or MINOR version:
- Edit
VERSIONfile directly:
- Update
package.json:
- Commit:
git commit -am "chore: bump to 0.1.0" - Push:
git push origin main
Next automated build will increment PATCH: 0.1.1
GitHub Pages Configuration¶
Prerequisites¶
- Enable GitHub Pages:
- Repository Settings → Pages
- Source: Deploy from a branch
- Branch:
gh-pages -
Folder:
/ (root) -
Set Base Path (if needed):
For project site (e.g., https://username.github.io/calendar/):
Update vite.config.ts:
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
base: '/calendar/',
plugins: [react()],
})
For user/org site (e.g., https://username.github.io/):
Deployment¶
- Automatically deploys on every push to
main - Application deployed to the GitHub Pages root URL
- Documentation deployed to the
/docs/subfolder of the same Pages site - Deployment URL shown in Actions workflow logs
Documentation URL¶
The MkDocs documentation is accessible at <pages-url>/docs/
(e.g., https://tiogars.github.io/calendar/docs/).
It is built with the
ghcr.io/tiogars/mkdocs-docker-image
Docker image using the mkdocs.yml configuration at the root of the repository.
GitHub Runner & Environment¶
- OS: Ubuntu latest (
ubuntu-latest) - Node.js: Version 20
- pnpm: Version 9.x
- Cache: Enabled for pnpm dependencies
- Concurrency: Maximum 1 deployment at a time
Permissions & Security¶
The workflow requires GitHub Actions permissions:
contents: write- Commit version bumps and create releasespages: write- Deploy to GitHub Pagesid-token: write- Secure OIDC token for Pages deployment
All automated commits use github-actions[bot] account.
Manual Workflow Trigger¶
Manually run the workflow from GitHub UI:
- Actions tab → "Build, Deploy & Release"
- Click "Run workflow"
- Select branch:
main - Click "Run workflow"
Useful for testing or deploying without code changes.
Artifacts & Outputs¶
Build Artifacts¶
- dist/: Primary build directory (Vite output)
- Uploaded as
distartifact with 1-day retention - Downloaded by deploy and release jobs
GitHub Pages¶
- Deployed to configured GitHub Pages URL
- Contains complete built site
- Accessible immediately after deployment
GitHub Releases¶
- Created with semantic version tag (
vX.Y.Z) - Release notes auto-generated from commit history
- Includes
calendar-X.Y.Z.ziparchive - Downloadable from GitHub Releases page
Troubleshooting¶
Workflow Fails on Lint¶
Markdown linting errors:
Fix issues locally, then commit.
ESLint errors:
Pages Not Updating¶
- Check repository Settings → Pages is enabled
- Verify
gh-pagesbranch exists - Check workflow logs in Actions tab
- Manually trigger workflow to retry
Version Commits Not Pushing¶
Verify GitHub Actions repository permissions:
- Settings → Actions → General
- Workflow permissions: "Read and write permissions"
- Allow GitHub Actions to create and approve pull requests
Release Creation Failed¶
Ensure repository allows:
- GitHub Actions to write releases
- No conflicting branch protections
- Sufficient storage quota for ZIP archives
Best Practices¶
- Always test locally before pushing:
- Keep VERSION file in sync with package.json
- Review automated commits in git history (version bumps)
- Monitor workflow runs in Actions tab after each push
- Use release archives for easy rollback and distribution