Skip to content

Commit a910d11

Browse files
Copilotckenst
andauthored
Implement automated version incrementing and Git tagging on deployments (#839)
* Initial plan * Add GitHub Actions workflow for automated version incrementing and deployment tagging Co-authored-by: ckenst <6896787+ckenst@users.noreply.github.com> * Fix VERSION.txt format to preserve no trailing newline Co-authored-by: ckenst <6896787+ckenst@users.noreply.github.com> * Add versioning and deployment documentation to README Co-authored-by: ckenst <6896787+ckenst@users.noreply.github.com> * Add error handling and race condition protection to deployment workflow Co-authored-by: ckenst <6896787+ckenst@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ckenst <6896787+ckenst@users.noreply.github.com>
1 parent 72ec1ae commit a910d11

3 files changed

Lines changed: 115 additions & 2 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Deploy to GitHub Pages with Version Increment
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pages: write
11+
id-token: write
12+
13+
# Allow only one concurrent deployment
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build-and-deploy:
20+
runs-on: ubuntu-latest
21+
environment:
22+
name: github-pages
23+
url: ${{ steps.deployment.outputs.page_url }}
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
fetch-depth: 0
30+
31+
- name: Read and Increment Version
32+
id: version
33+
run: |
34+
# Check if VERSION.txt exists
35+
if [ ! -f _includes/VERSION.txt ]; then
36+
echo "ERROR: _includes/VERSION.txt not found"
37+
exit 1
38+
fi
39+
40+
# Read current version
41+
CURRENT_VERSION=$(cat _includes/VERSION.txt)
42+
echo "Current version: $CURRENT_VERSION"
43+
44+
# Increment version
45+
NEW_VERSION=$((CURRENT_VERSION + 1))
46+
echo "New version: $NEW_VERSION"
47+
48+
# Write new version (without trailing newline to match original format)
49+
echo -n "$NEW_VERSION" > _includes/VERSION.txt
50+
51+
# Set output for later steps
52+
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
53+
54+
- name: Setup Ruby
55+
uses: ruby/setup-ruby@v1
56+
with:
57+
ruby-version: '3.1'
58+
bundler-cache: true
59+
60+
- name: Setup Pages
61+
uses: actions/configure-pages@v4
62+
63+
- name: Build with Jekyll
64+
run: bundle exec jekyll build
65+
env:
66+
JEKYLL_ENV: production
67+
68+
- name: Commit Version File
69+
run: |
70+
git config user.name "github-actions[bot]"
71+
git config user.email "github-actions[bot]@users.noreply.github.com"
72+
git add _includes/VERSION.txt
73+
74+
# Only commit and push if there are changes
75+
if git diff --staged --quiet; then
76+
echo "No changes to commit"
77+
else
78+
git commit -m "chore: bump version to ${{ steps.version.outputs.version }}"
79+
git push
80+
fi
81+
82+
- name: Create Git Tag
83+
run: |
84+
# Check if tag already exists (could happen with concurrent runs)
85+
if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
86+
echo "Tag v${{ steps.version.outputs.version }} already exists, skipping tag creation"
87+
else
88+
git tag -a "v${{ steps.version.outputs.version }}" -m "Release version ${{ steps.version.outputs.version }}"
89+
git push origin "v${{ steps.version.outputs.version }}"
90+
fi
91+
92+
- name: Upload artifact
93+
uses: actions/upload-pages-artifact@v3
94+
with:
95+
path: ./_site
96+
97+
- name: Deploy to GitHub Pages
98+
id: deployment
99+
uses: actions/deploy-pages@v4

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ A good _heuristic_ for whether a conference should be included is if its name in
6161

6262
Don't forget to **[sign up](http://eepurl.com/c4paYT)** for our once **monthly newsletter.**
6363

64+
## Versioning and Deployments
65+
66+
The site uses an automated versioning system to track each deployment:
67+
68+
- **Version Number**: Every deployment to production automatically increments the version number stored in `_includes/VERSION.txt`
69+
- **Git Tags**: Each deployment is tagged in Git with the format `vXXXX` (e.g., `v1501`)
70+
- **Footer Display**: The current version is displayed in the site footer as `rev.XXXX.`
71+
- **Workflow**: The `.github/workflows/deploy.yml` workflow handles version incrementing, tagging, and deployment on every push to `main`
72+
73+
This versioning system enables:
74+
- Tracking which version of the site is deployed
75+
- Associating bug reports with specific deployments
76+
- Measuring quality metrics across versions (see [ROADMAP.md](ROADMAP.md))
77+
6478

6579
## License
6680

ROADMAP.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Continue to use TCorg to experiment and learn. I want to track quality metrics a
1010

1111
- [x] **Implement `VERSION` file**: Create a plaintext file in the root directory to track SemVer (e.g., `1.0.0`).
1212
- [x] **Footer Integration**: Update the website footer to dynamically display the current string from the `VERSION` file.
13-
- [ ] **Automated Increments**: Create a workflow to increment the `VERSION` file on every deployment.
14-
- [ ] **Deployment Tagging**: Ensure every production deploy is tagged in Git to match the internal version.
13+
- [x] **Automated Increments**: Create a workflow to increment the `VERSION` file on every deployment.
14+
- [x] **Deployment Tagging**: Ensure every production deploy is tagged in Git to match the internal version.
1515

1616
## Phase 2: Quality Ledger & Metrics
1717
*Goal: Associate every site version with a specific quality snapshot.*

0 commit comments

Comments
 (0)