Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
node-version: "22"

- name: Install root dependencies (semantic-release)
run: npm clean-install
run: npm install

- name: Install Frontend Dependencies
run: |
Expand All @@ -75,22 +75,27 @@ jobs:
# RUN semantic-release
# ---------------------------------------
- name: Run semantic-release
id: semrel
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release

- name: Get release version
run: |
VERSION=$(npx semantic-release --no-ci)
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || true)
echo "VERSION=$VERSION" >> $GITHUB_ENV

# If no version created, stop job
- name: Stop if no new release
if: env.VERSION == ''
run: echo "No new release version — skipping Docker build." && exit 0
run: |
echo "No new release — skipping Docker build"
exit 0

# ---------------------------------------
# LOGIN TO DOCKER HUB
# ---------------------------------------
- name: Login to DockerHub
if: env.VERSION != ''
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -100,6 +105,7 @@ jobs:
# BACKEND DOCKER BUILD + PUSH
# ---------------------------------------
- name: Build Backend Image
if: env.VERSION != ''
run: |
docker build \
-f Dockerfile.backend \
Expand All @@ -108,6 +114,7 @@ jobs:
.

- name: Push Backend Images
if: env.VERSION != ''
run: |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/ops-backend:${VERSION}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/ops-backend:latest
Expand All @@ -116,6 +123,7 @@ jobs:
# FRONTEND DOCKER BUILD + PUSH
# ---------------------------------------
- name: Build Frontend Image
if: env.VERSION != ''
run: |
docker build \
-f frontend/Dockerfile \
Expand All @@ -124,6 +132,7 @@ jobs:
frontend

- name: Push Frontend Images
if: env.VERSION != ''
run: |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/ops-frontend:${VERSION}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/ops-frontend:latest
4 changes: 2 additions & 2 deletions backend/Repositories/Cart/CartRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public class CartRepository : ICartRepository

public async Task<Guid> GetCartIdAsync(Guid userId)
{
const string sql = @"SELECT cart_id FROM cart WHERE u_id = @UserId;";
var id = await _db.QuerySingleOrDefaultAsync<Guid?>(sql, new { UserId = userId });
const string sql = @"SELECT cart_id FROM cart WHERE u_id = @UserId ORDER BY cart_id LIMIT 1;";
var id = await _db.QueryFirstOrDefaultAsync<Guid?>(sql, new { UserId = userId });
if (id == null)
{
const string insert = @"INSERT INTO cart(u_id) VALUES(@UserId) RETURNING cart_id;";
Expand Down
Loading
Loading