Skip to content
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 v1.0.0 #141

Merged
merged 4 commits into from
Sep 7, 2024
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
7 changes: 4 additions & 3 deletions .github/workflows/prod-ci.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
name: prod-CI
name: CI

on:
pull_request:
branches: [ "main" ]
branches:
- '*'

jobs:
build:
runs-on: ubuntu-22.04

steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
token: ${{ secrets.SUBMODULE_TOKEN }}
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/dev-ci.yml

This file was deleted.

33 changes: 31 additions & 2 deletions .github/workflows/prod-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ jobs:
env:
working-directory: .


steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
token: ${{ secrets.SUBMODULE_TOKEN }}
Expand Down Expand Up @@ -60,3 +59,33 @@ jobs:
script: |
cd ~
./deploy.sh

create-release:
needs: cd
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: 버전 정보 추출
id: extract_version_name
run: |
VERSION=$(echo "${{ github.event.head_commit.message }}" | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -n1 | tr -d '[:space:]')

if [ -z "$VERSION" ]; then
echo "No version found in the commit message."
exit 1
fi

- name: Create GitHub Release
run: |
response=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.SUBMODULE_TOKEN }}" \
https://api.github.com/repos/OMZigak/KKUMER/releases \
-d '{"tag_name":"${{ steps.extract_version_name.outputs.version }}","target_commitish":"main","name":"${{ steps.extract_version_name.outputs.version }}","generate_release_notes":true}')

if [ "$response" -ne 201 ]; then
echo "GitHub Release failed with status code $response"
exit 1
fi
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.extern.slf4j.Slf4j;
import org.kkumulkkum.server.domain.Meeting;
import org.kkumulkkum.server.domain.Member;
import org.kkumulkkum.server.domain.Promise;
import org.kkumulkkum.server.dto.meeting.MeetingMetCountDto;
import org.kkumulkkum.server.dto.meeting.request.MeetingCreateDto;
import org.kkumulkkum.server.dto.meeting.request.MeetingRegisterDto;
Expand All @@ -18,7 +19,9 @@
import org.kkumulkkum.server.service.member.MemberRetreiver;
import org.kkumulkkum.server.service.member.MemberSaver;
import org.kkumulkkum.server.service.participant.ParticipantRemover;
import org.kkumulkkum.server.service.participant.ParticipantRetriever;
import org.kkumulkkum.server.service.promise.PromiseRemover;
import org.kkumulkkum.server.service.promise.PromiseRetriever;
import org.kkumulkkum.server.service.user.UserRetriever;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand All @@ -41,6 +44,8 @@ public class MeetingService {
private final MemberRemover memberRemover;
private final PromiseRemover promiseRemover;
private final MeetingRemover meetingRemover;
private final PromiseRetriever promiseRetriever;
private final ParticipantRetriever participantRetriever;

@Transactional
public CreatedMeetingDto createMeeting(
Expand Down Expand Up @@ -127,6 +132,9 @@ public void leaveMeeting(
promiseRemover.deleteByMeetingId(meetingId);
meetingRemover.deleteById(meetingId);
}

//모임 내의 약속들 모두 돌려서, 거기서 참여자가 없는 약속이 있다면 지우기
removeEmptyPromises(meetingId);
}

private String generateInvitationCode() {
Expand All @@ -152,4 +160,10 @@ private String generateRandomCode() {
return codeBuilder.toString();
}

private void removeEmptyPromises(final Long meetingId) {
promiseRetriever.findAllByMeetingId(meetingId).stream()
.filter(promise -> participantRetriever.findAllByPromiseId(promise.getId()).isEmpty())
.forEach(promise -> promiseRemover.deleteById(promise.getId()));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,4 @@ private void removeOldParticipants(
}).toList()
);
}

}
Loading