GitHub Pages & Releases
Quick Summary
GitHub Pages hosts static websites (docs, portfolios, project sites) for free directly from your repository. Releases let you package and distribute versioned snapshots of your project with changelogs, binaries, and release notes.
GitHub Pages
Setup Methods
- Deploy from Branch
- Deploy via Actions
- Go to Settings → Pages
- Under Source, select
Deploy from a branch - Choose
mainbranch and/docsfolder (or root/) - Click Save
Your site will be live at https://username.github.io/repository/
# .github/workflows/deploy-pages.yml
name: Deploy to GitHub Pages
on:
push:
branches: [main]
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci && npm run build
- uses: actions/upload-pages-artifact@v3
with:
path: './build'
- id: deployment
uses: actions/deploy-pages@v4
Custom Domain
- Add a
CNAMEfile to your repository root:docs.example.com - Configure DNS: Add a CNAME record pointing to
username.github.io - In Settings → Pages, enter your custom domain
- Enable Enforce HTTPS
Releases
Creating a Release
- Via GitHub Web
- Via Git CLI
- Via GitHub CLI
- Go to Releases (right sidebar) → Draft a new release
- Choose or create a tag (e.g.,
v2.0.0) - Write release title and notes
- Attach binary files if needed
- Click Publish release
# Create an annotated tag
git tag -a v2.0.0 -m "Release version 2.0.0"
# Push the tag to GitHub
git push origin v2.0.0
# Push all tags
git push --tags
# Create a release with auto-generated notes
gh release create v2.0.0 --generate-notes
# Create with custom notes
gh release create v2.0.0 --title "Version 2.0.0" --notes "Major update with new features"
# Create and attach files
gh release create v2.0.0 ./dist/app.zip ./dist/app.tar.gz
Semantic Versioning
MAJOR.MINOR.PATCH
v2.1.3
│ │ └── Patch: bug fixes (backward compatible)
│ └──── Minor: new features (backward compatible)
└────── Major: breaking changes
| Change Type | Version Bump | Example |
|---|---|---|
| Bug fix | v1.0.0 → v1.0.1 | Fix login crash |
| New feature (backward compatible) | v1.0.1 → v1.1.0 | Add dark mode |
| Breaking change | v1.1.0 → v2.0.0 | Remove deprecated API |
Auto-Generated Release Notes
GitHub can automatically create release notes from merged PRs:
- Create
.github/release.yml:
changelog:
categories:
- title: "🚀 Features"
labels: ["feat", "feature"]
- title: "🐛 Bug Fixes"
labels: ["fix", "bug"]
- title: "📚 Documentation"
labels: ["docs"]
- title: "🔧 Maintenance"
labels: ["chore", "refactor"]
- When creating a release, click Generate release notes — PRs are automatically grouped by label.
Best Practices
- Use GitHub Actions for Pages deployment — more control than branch-based
- Tag every release with semantic versioning
- Write clear release notes — users and collaborators depend on them
- Automate release notes with PR labels and
.github/release.yml - Pin dependencies in release builds — ensure reproducible builds
What's Next
- Security Features — Dependabot, code scanning, and secret scanning
- Advanced Git — Rewrite history and automate with hooks