Compare commits
2 Commits
89d0d08162
...
f4aca275de
| Author | SHA1 | Date | |
|---|---|---|---|
| f4aca275de | |||
| fe133eab99 |
@@ -78,16 +78,20 @@ 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
|
if git diff --cached --quiet; then
|
||||||
echo "No changes to commit (version may already be at target version)"
|
echo "No changes to commit (version may already be at target version)"
|
||||||
|
echo "committed=false" >> $GITHUB_OUTPUT
|
||||||
else
|
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
|
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"
|
||||||
@@ -101,9 +105,11 @@ jobs:
|
|||||||
fi
|
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 \
|
||||||
@@ -112,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" \
|
||||||
@@ -119,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 \
|
||||||
@@ -128,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
|
||||||
@@ -152,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
|
||||||
|
|||||||
+10
-2
@@ -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 [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user