5 Commits

Author SHA1 Message Date
Gitea Actions ec3297befe chore: bump version to v0.1.3 2026-04-01 06:31:42 +00:00
david f4aca275de fix: skip release steps if no version bump commit was made
Pull Request / unit-tests (pull_request) Successful in 2m4s
Pull Request / acceptance-tests (pull_request) Failing after 2m17s
Pull Request / analyze-bump-type (pull_request) Has been skipped
Test / unit-tests (push) Successful in 2m38s
Release / release (push) Failing after 7m25s
- Set output variable 'committed' in commit step
- Add conditional execution to all subsequent steps
- Only create tag, build Docker images, and deploy if commit was successful
2026-03-31 23:23:01 -07:00
david fe133eab99 fix: improve error handling in getCommitsSinceLastTag
- Add nested try-catch to handle git log failures
- Return empty array if all git attempts fail
- Add warning message when commit history cannot be retrieved
2026-03-31 23:22:38 -07:00
david 89d0d08162 fix: add tag existence check in release workflow
Test / unit-tests (push) Successful in 2m22s
- Check if tag already exists before creating it
- Skip tag creation if tag already exists
2026-03-31 23:19:31 -07:00
david fe18a8b9fe fix: resolve release workflow version bump issues
- Fixed bump-version.js to properly handle --yes flag in CI environments
- Added check to skip commit if no changes to package.json or CHANGELOG.md
- Ensured script exits cleanly after version bump with --yes flag
2026-03-31 23:19:31 -07:00
4 changed files with 98 additions and 35 deletions
+20
View File
@@ -78,22 +78,38 @@ jobs:
echo "New version: $NEW_VERSION" echo "New version: $NEW_VERSION"
- name: Commit version bump - name: Commit version bump
id: commit
run: | run: |
git add package.json CHANGELOG.md git add package.json CHANGELOG.md
if git diff --cached --quiet; then
echo "No changes to commit (version may already be at target version)"
echo "committed=false" >> $GITHUB_OUTPUT
else
git commit -m "chore: bump version to v${{ steps.version.outputs.new_version }}" git commit -m "chore: bump version to v${{ steps.version.outputs.new_version }}"
git push origin main git push origin main
echo "committed=true" >> $GITHUB_OUTPUT
fi
- name: Create git tag for release - name: Create git tag for release
if: steps.commit.outputs.committed == 'true'
run: | run: |
TAG_NAME="v${{ steps.version.outputs.new_version }}" TAG_NAME="v${{ steps.version.outputs.new_version }}"
echo "Creating tag $TAG_NAME" echo "Creating tag $TAG_NAME"
# Check if tag already exists
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
echo "Tag $TAG_NAME already exists, skipping tag creation"
else
git tag -a "$TAG_NAME" -m "Release $TAG_NAME" git tag -a "$TAG_NAME" -m "Release $TAG_NAME"
git push origin "$TAG_NAME" git push origin "$TAG_NAME"
fi
- name: Set up Docker Buildx - name: Set up Docker Buildx
if: steps.commit.outputs.committed == 'true'
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Build test-capable image - name: Build test-capable image
if: steps.commit.outputs.committed == 'true'
run: | run: |
docker build \ docker build \
--target test-runner \ --target test-runner \
@@ -102,6 +118,7 @@ jobs:
. .
- name: Run tests inside test-capable container - name: Run tests inside test-capable container
if: steps.commit.outputs.committed == 'true'
run: | run: |
docker run --rm \ docker run --rm \
-e DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" \ -e DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" \
@@ -109,6 +126,7 @@ jobs:
npm run test:run npm run test:run
- name: Build production image - name: Build production image
if: steps.commit.outputs.committed == 'true'
run: | run: |
docker build \ docker build \
--target runner \ --target runner \
@@ -118,6 +136,7 @@ jobs:
. .
- name: Push Docker images - name: Push Docker images
if: steps.commit.outputs.committed == 'true'
run: | run: |
echo "Pushing to ${{ env.REGISTRY }}..." echo "Pushing to ${{ env.REGISTRY }}..."
# Check if we can authenticate to the registry using DOCKER_LOGIN and DOCKER_PASSWORD secrets # Check if we can authenticate to the registry using DOCKER_LOGIN and DOCKER_PASSWORD secrets
@@ -142,6 +161,7 @@ jobs:
fi fi
- name: Deploy to dev (placeholder) - name: Deploy to dev (placeholder)
if: steps.commit.outputs.committed == 'true'
run: | run: |
echo "Deploying version ${{ steps.version.outputs.new_version }} to dev environment..." echo "Deploying version ${{ steps.version.outputs.new_version }} to dev environment..."
# TODO: Add actual deployment steps # TODO: Add actual deployment steps
+25
View File
@@ -1,3 +1,28 @@
## [0.1.3] - 2026-04-01
### Patch Changes
- fix: skip release steps if no version bump commit was made
- fix: improve error handling in getCommitsSinceLastTag
- fix: add tag existence check in release workflow
- fix: resolve release workflow version bump issues
- ci-image-improvements (#18)
- fix: version bumping and Docker registry authentication (#17)
- fix: handle Docker registry authentication gracefully in release workflow
- fix: run unit tests on branch commits, skip main branch
- feat: add test workflow for every commit
- trigger: release with test-capable image
- feat: build test-capable image, run tests, then build production image
- trigger: release workflow
- fix: release workflow should not commit, only tag
- trigger: manual workflow trigger for docker.notsosm.art
- fix: update Docker build script to use docker.notsosm.art registry
- fix: update workflow to use docker.notsosm.art registry
- trigger: manual workflow trigger
- fix: update workflow to use correct Docker registries
- feat: add Gitea Actions release workflow
- feat: add view match link to admin matches page
## [0.1.2] - 2026-04-01 ## [0.1.2] - 2026-04-01
### Patch Changes ### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "euchre_camp", "name": "euchre_camp",
"version": "0.1.2", "version": "0.1.3",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "NEXT_PUBLIC_GIT_COMMIT=$(git rev-parse --short HEAD) next dev", "dev": "NEXT_PUBLIC_GIT_COMMIT=$(git rev-parse --short HEAD) next dev",
+27 -9
View File
@@ -48,14 +48,22 @@ function getCommitsSinceLastTag() {
if (!latestTag) { if (!latestTag) {
// No tags yet, get all commits // No tags yet, get all commits
return execSync('git log --oneline --format=%s', { encoding: 'utf8' }).trim().split('\n'); const commits = execSync('git log --oneline --format=%s', { encoding: 'utf8' }).trim();
return commits ? commits.split('\n') : [];
} }
const commits = execSync(`git log ${latestTag}..HEAD --oneline --format=%s`, { encoding: 'utf8' }).trim(); const commits = execSync(`git log ${latestTag}..HEAD --oneline --format=%s`, { encoding: 'utf8' }).trim();
return commits ? commits.split('\n') : []; return commits ? commits.split('\n') : [];
} catch (error) { } catch (error) {
// If no commits since tag or other error, get recent commits // If no commits since tag or other error, get recent commits
return execSync('git log --oneline --format=%s -n 20', { encoding: 'utf8' }).trim().split('\n'); try {
const commits = execSync('git log --oneline --format=%s -n 20', { encoding: 'utf8' }).trim();
return commits ? commits.split('\n') : [];
} catch (innerError) {
// If all git log attempts fail, return empty array
console.warn('Warning: Could not retrieve commit history, defaulting to patch version');
return [];
}
} }
} }
@@ -175,7 +183,20 @@ function main() {
console.log(`New version: ${currentVersion}${newVersion}`); console.log(`New version: ${currentVersion}${newVersion}`);
} }
// Confirm with user // Confirm with user (or skip if --yes flag is set)
if (skipConfirm) {
// Update package.json
updatePackageJson(newVersion);
// Update changelog
if (bumpType !== 'custom') {
const commits = getCommitsSinceLastTag();
updateChangelog(newVersion, commits, bumpType);
}
console.log(`\n✅ Version bumped to ${newVersion}`);
process.exit(0);
} else {
const readline = require('readline'); const readline = require('readline');
const rl = readline.createInterface({ const rl = readline.createInterface({
input: process.stdin, input: process.stdin,
@@ -194,19 +215,16 @@ function main() {
} }
console.log(`\n✅ Version bumped to ${newVersion}`); console.log(`\n✅ Version bumped to ${newVersion}`);
console.log(`\nNext steps:`); process.exit(0);
console.log(` 1. Review changes: git diff`);
console.log(` 2. Commit changes: git commit -am "chore: bump version to v${newVersion}"`);
console.log(` 3. Create tag: git tag -a v${newVersion} -m "Release v${newVersion}"`);
console.log(` 4. Push changes: git push origin main`);
console.log(` 5. Push tag: git push origin v${newVersion}`);
} else { } else {
console.log('❌ Version bump cancelled'); console.log('❌ Version bump cancelled');
process.exit(1);
} }
rl.close(); rl.close();
}); });
} }
}
// Run main function // Run main function
main(); main();