-
Notifications
You must be signed in to change notification settings - Fork 7
Release v0.5.0 #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release v0.5.0 #101
Changes from all commits
75d24b6
6d88625
2536bcb
0a75c8c
ab766ab
d718efc
e653bf7
144fe65
77d2d6a
e53ddaa
cadfe67
86d2e93
ec4f14f
7afc3e4
c539f7c
a6b7eca
b087010
44a0eb5
c97cc55
35c242a
9d7648d
6dd7153
b58f976
22abecd
35a8e7d
be9962a
8e091f2
52ae1aa
83ec44e
5811505
59c94a6
9c5d22b
a3305b5
6a89c7a
f08bba5
35482a7
c95f897
8098c6b
90bc5fd
cb83472
aa05bd7
1b9e3b0
8a312ca
d5b3375
e17fa2f
ec421b3
8848d86
6c92bd3
326f29c
dba6a96
2a66d80
2d6dc94
7cf0615
000d987
01a7c6f
63498a1
adb562f
9585916
9a31fe6
f1fe3d7
5c0c118
8ceba9d
216a315
eb7f023
24d3811
4794cc9
92f8dc6
9a74cfd
af12515
ba93380
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,205 @@ | ||
| name: Build and Push Docker Images | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - closed | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| check_version_update: | ||
| name: Check Version Updates | ||
| if: github.event.pull_request.merged | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| build_backend: ${{ steps.version_check.outputs.build_backend }} | ||
| build_frontend: ${{ steps.version_check.outputs.build_frontend }} | ||
| backend_version: ${{ steps.version_check.outputs.backend_version }} | ||
| frontend_version: ${{ steps.version_check.outputs.frontend_version }} | ||
| steps: | ||
| - name: Check out the repo | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 2 # Need at least 2 commits to compare | ||
|
|
||
| - name: Detect version changes | ||
| id: version_check | ||
| run: | | ||
| echo "🔍 Checking for version changes..." | ||
|
|
||
| # Get current commit and previous commit | ||
| CURRENT_COMMIT=$(git rev-parse HEAD) | ||
| # Previous commit refers to the latest commit on main before the PR | ||
| # was merged | ||
| PREVIOUS_COMMIT=$(git rev-parse HEAD~1) | ||
|
|
||
| echo "Current commit: $CURRENT_COMMIT" | ||
| echo "Previous commit: $PREVIOUS_COMMIT" | ||
|
|
||
| # Initialize build flags and version variables | ||
| BUILD_BACKEND=false | ||
| BUILD_FRONTEND=false | ||
| # Extract current versions for backend and frontend | ||
| BACKEND_VERSION=$(grep '^version = ' backend-agent/pyproject.toml | sed "s/version = '\(.*\)'/\1/") | ||
| FRONTEND_VERSION=$(grep '"version":' frontend/package.json | sed 's/.*"version": "\(.*\)".*/\1/') | ||
|
|
||
| # Check if backend version file changed | ||
| if git diff --name-only $PREVIOUS_COMMIT $CURRENT_COMMIT | grep -q 'backend-agent/pyproject.toml'; then | ||
| # Extract previous backend version | ||
| PREVIOUS_BACKEND_VERSION=$(git show $PREVIOUS_COMMIT:backend-agent/pyproject.toml | grep '^version = ' | sed "s/version = '\(.*\)'/\1/") | ||
| echo "Backend version - Current: $BACKEND_VERSION, Previous: $PREVIOUS_BACKEND_VERSION" | ||
|
|
||
| if [ "$BACKEND_VERSION" != "$PREVIOUS_BACKEND_VERSION" ]; then | ||
| # The version has changed, set flag to build backend | ||
| BUILD_BACKEND=true | ||
| echo "✅ Backend version changed: $PREVIOUS_BACKEND_VERSION → $BACKEND_VERSION" | ||
| else | ||
| echo "❎ Backend version unchanged: $BACKEND_VERSION. Skip docker backend." | ||
| fi | ||
|
Comment on lines
+53
to
+59
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script assumes that version changes always indicate the need to build. Consider adding validation to ensure the version actually increased (not decreased or unchanged in a different way): if [ "$BACKEND_VERSION" != "$PREVIOUS_BACKEND_VERSION" ]; then
# Add semantic version comparison here
if [[ "$BACKEND_VERSION" > "$PREVIOUS_BACKEND_VERSION" ]]; then
BUILD_BACKEND=true
echo "✅ Backend version increased: $PREVIOUS_BACKEND_VERSION → $BACKEND_VERSION"
else
echo "⚠️ Backend version changed but not increased: $PREVIOUS_BACKEND_VERSION → $BACKEND_VERSION"
fi
fi |
||
| fi | ||
|
|
||
| # Check if frontend version file changed | ||
| if git diff --name-only $PREVIOUS_COMMIT $CURRENT_COMMIT | grep -q 'frontend/package.json'; then | ||
| # Extract previous frontend version | ||
| PREVIOUS_FRONTEND_VERSION=$(git show $PREVIOUS_COMMIT:frontend/package.json | grep '"version":' | sed 's/.*"version": "\(.*\)".*/\1/') | ||
| echo "Frontend version - Current: $FRONTEND_VERSION, Previous: $PREVIOUS_FRONTEND_VERSION" | ||
|
|
||
| if [ "$FRONTEND_VERSION" != "$PREVIOUS_FRONTEND_VERSION" ]; then | ||
| # The version has changed, set flag to build frontend | ||
| BUILD_FRONTEND=true | ||
| echo "✅ Frontend version changed: $PREVIOUS_FRONTEND_VERSION → $FRONTEND_VERSION" | ||
| else | ||
| echo "❎ Frontend version unchanged: $FRONTEND_VERSION. Skip docker frontend." | ||
| fi | ||
| fi | ||
|
|
||
| # Set build outputs | ||
| echo "build_backend=$BUILD_BACKEND" >> $GITHUB_OUTPUT | ||
| echo "build_frontend=$BUILD_FRONTEND" >> $GITHUB_OUTPUT | ||
| echo "backend_version=$BACKEND_VERSION" >> $GITHUB_OUTPUT | ||
| echo "frontend_version=$FRONTEND_VERSION" >> $GITHUB_OUTPUT | ||
|
|
||
| if [ "$BUILD_BACKEND" = "false" ] && [ "$BUILD_FRONTEND" = "false" ]; then | ||
| echo "⚠️ No version changes detected. Skipping builds." | ||
| fi | ||
|
|
||
| build-backend: | ||
| name: Build and Push Backend Docker Image | ||
| if: github.event.pull_request.merged && needs.check_version_update.outputs.build_backend == 'true' | ||
| needs: check_version_update | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out the repo | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Log in to Docker Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ secrets.DOCKER_REGISTRY_URL }} | ||
| username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | ||
| password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | ||
|
|
||
| - name: 🐳 Build and push Backend Docker image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: ./backend-agent | ||
| file: ./backend-agent/Dockerfile | ||
| push: true | ||
| tags: | | ||
| ${{ secrets.DOCKER_REGISTRY_URL }}/stars-backend:${{ needs.check_version_update.outputs.backend_version }} | ||
| ${{ secrets.DOCKER_REGISTRY_URL }}/stars-backend:latest | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
Comment on lines
+106
to
+116
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding error handling for Docker build failures and implementing retry logic for robustness: - name: 🐳 Build and push Backend Docker image
uses: docker/build-push-action@v6
with:
context: ./backend-agent
file: ./backend-agent/Dockerfile
push: true
tags: |
${{ secrets.DOCKER_REGISTRY_URL }}/stars-backend:${{ needs.check_version_update.outputs.backend_version }}
${{ secrets.DOCKER_REGISTRY_URL }}/stars-backend:latest
cache-from: type=gha
cache-to: type=gha,mode=max
retry:
max_attempts: 3
retry_wait_seconds: 30 |
||
|
|
||
| - name: Backend Build Summary | ||
| run: | | ||
| echo "Backend Build Complete" | ||
| echo "✅ Backend: stars-backend:${{ needs.check_version_update.outputs.backend_version }}" | ||
|
|
||
| build-frontend: | ||
| name: Build and Push Frontend Docker Image | ||
| if: github.event.pull_request.merged && needs.check_version_update.outputs.build_frontend == 'true' | ||
| needs: check_version_update | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out the repo | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Set up Node.js for Frontend build | ||
| uses: actions/setup-node@v5 | ||
| with: | ||
| node-version: '24' | ||
| cache: 'npm' | ||
| cache-dependency-path: frontend/package-lock.json | ||
|
|
||
| - name: Build Angular application | ||
| run: | | ||
| cd frontend | ||
| npm ci | ||
| npm run build -- --configuration production | ||
| # Verify build output exists | ||
| ls -la dist/ | ||
|
|
||
marcorosa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Log in to Docker Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ secrets.DOCKER_REGISTRY_URL }} | ||
| username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | ||
| password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | ||
|
|
||
| - name: 🐳 Build and push Frontend Docker image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: ./frontend | ||
| file: ./frontend/Dockerfile | ||
| push: true | ||
| tags: | | ||
| ${{ secrets.DOCKER_REGISTRY_URL }}/stars-frontend:${{ needs.check_version_update.outputs.frontend_version }} | ||
| ${{ secrets.DOCKER_REGISTRY_URL }}/stars-frontend:latest | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Frontend Build Summary | ||
| run: | | ||
| echo "Frontend Build Complete" | ||
| echo "✅ Frontend: stars-frontend:${{ needs.check_version_update.outputs.frontend_version }}" | ||
|
|
||
| build-summary: | ||
| name: Build Pipeline Summary | ||
| needs: [check_version_update, build-backend, build-frontend] | ||
| runs-on: ubuntu-latest | ||
| # Allow this job to run even if backend or frontend jobs are skipped | ||
| if: always() && github.event.pull_request.merged | ||
| steps: | ||
| - name: Pipeline Summary | ||
| run: | | ||
| echo "STARS Build Pipeline Summary" | ||
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | ||
| # Backend | ||
| if [ "${{ needs.check_version_update.outputs.build_backend }}" = "true" ]; then | ||
| if [ "${{ needs.build-backend.result }}" = "success" ]; then | ||
| echo "✅ Backend: stars-backend:${{ needs.check_version_update.outputs.backend_version }}" | ||
| else | ||
| echo "❌ Backend: Build failed" | ||
| fi | ||
| else | ||
| echo "⏭️ (SKIP) Backend: No version change detected" | ||
| fi | ||
| # Frontend | ||
| if [ "${{ needs.check_version_update.outputs.build_frontend }}" = "true" ]; then | ||
| if [ "${{ needs.build-frontend.result }}" = "success" ]; then | ||
| echo "✅ Frontend: stars-frontend:${{ needs.check_version_update.outputs.frontend_version }}" | ||
| else | ||
| echo "❌ Frontend: Build failed" | ||
| fi | ||
| else | ||
| echo "⏭️ (SKIP) Frontend: No version change detected" | ||
| fi | ||
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: AI-assisted | ||
| on: | ||
| pull_request: | ||
| types: [ready_for_review, opened, reopened] | ||
|
|
||
| jobs: | ||
| summary: | ||
| name: PR Summary | ||
| runs-on: [ubuntu-latest] | ||
| steps: | ||
| - uses: SAP/ai-assisted-github-actions/pr-summary@v3 | ||
| with: | ||
| aicore-service-key: ${{ secrets.AICORE_SERVICE_KEY }} | ||
| model: gpt-4o | ||
| exclude-files: package-lock.json, uv.lock | ||
|
Comment on lines
+6
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The workflow lacks proper error handling and could benefit from conditional execution. Consider adding failure handling: jobs:
summary:
name: PR Summary
runs-on: [ubuntu-latest]
continue-on-error: true # Don't fail the entire PR if AI summary fails
steps:
- uses: SAP/ai-assisted-github-actions/pr-summary@v3
with:
aicore-service-key: ${{ secrets.AICORE_SERVICE_KEY }}
model: gpt-4o
exclude-files: package-lock.json, uv.lock
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
||
| review: | ||
| name: PR Review | ||
| runs-on: [ubuntu-latest] | ||
| steps: | ||
| - uses: SAP/ai-assisted-github-actions/pr-review@v3 | ||
| with: | ||
| aicore-service-key: ${{ secrets.AICORE_SERVICE_KEY }} | ||
| model: anthropic--claude-4-sonnet | ||
| exclude-files: package-lock.json, uv.lock | ||
| footer-text: | | ||
| --- | ||
| > Always critique what AI says. Do not let AI replace YOUR I. | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version extraction logic using
sedis fragile and could break with different formatting. Consider using a more robust JSON/TOML parser or add validation: