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

GitHub action #44

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
61eacbc
Update build.gradle
123wwwa Dec 28, 2022
5fa283b
Update build.gradle
123wwwa Dec 28, 2022
35119b3
Merge branch 'main' of https://github.com/HeXA-UNIST/hexa-homepage-20…
123wwwa Jan 6, 2023
83dc1b6
implement test code: NewsRepositoryCustomTest, MainPageControllerTest…
HyunsuYEE Jul 25, 2023
5454b80
Merge pull request #21
HyunsuYEE Jul 25, 2023
7de118e
Create gradle.yml
eumppe Nov 10, 2023
a027551
not_done
eumppe Nov 10, 2023
2ae3ea8
test and run docker compose
eumppe Nov 25, 2023
7bbdea2
test and run
eumppe Jan 1, 2024
383568a
골고루 이상했구만
eumppe Jan 1, 2024
8de4911
github-action hmm
eumppe Jan 1, 2024
020ba3e
github-action idk
eumppe Jan 1, 2024
bc4ec90
아니 왜 action 안생김
eumppe Jan 1, 2024
9b3c876
뭐야 왜 hello action만 생김
eumppe Jan 1, 2024
4a4f4ea
뭐가문젤까
eumppe Jan 1, 2024
a2f29c2
아 오타
eumppe Jan 1, 2024
3492a13
tags문제인가
eumppe Jan 1, 2024
cbbafa6
줄바꿈 문제인가
eumppe Jan 2, 2024
1c0365b
줄바꿈 문제인가2
eumppe Jan 2, 2024
21ab1e5
줄바꿈 문제인가3
eumppe Jan 2, 2024
a8049c5
왜 푸쉬 아래 조건을 인식 못할까
eumppe Jan 2, 2024
b12f453
env 문제인가
eumppe Jan 2, 2024
4c7a097
env 문제인가2
eumppe Jan 2, 2024
232dc49
line 문제인가2
eumppe Jan 6, 2024
73f2dd9
아니 뭐가 문제인거야
eumppe Jan 6, 2024
a0da6d4
뭐냐 왜 test는 인식 잘 하냐
eumppe Jan 6, 2024
b7dcbcc
몰라 일단 계속 해봐
eumppe Jan 6, 2024
443091c
이전 container가 존재하지 않는 예외상황
eumppe Jan 6, 2024
0c06931
태그 생성시 작동하게
eumppe Jan 6, 2024
094d7bc
태그 조건 수정
eumppe Jan 6, 2024
d49141a
test2는 인식 하나
eumppe Jan 10, 2024
133c1d6
으아아아아
eumppe Jan 10, 2024
d334122
tag 조건을 if문으로
eumppe Jan 10, 2024
cb2f61f
push를 create로
eumppe Jan 10, 2024
0bde2a6
create에 콜론
eumppe Jan 10, 2024
6fafafa
create에 콜론mhfhgfhgh
eumppe Jan 10, 2024
1a5368e
github event ref의 정체는
eumppe Jan 10, 2024
96a36c2
github event ref의 정체는2
eumppe Jan 10, 2024
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
56 changes: 56 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Deployment

on:
push:
release:
types: [ created ]

jobs:
deploy:
name: Deploy
# if: startsWith(github.event.ref, 'refs/tags/v')
env:
github_event_ref: github.event.ref
runs-on: self-hosted


steps:

- uses: actions/checkout@v4

- name: is the github action running
run: |
echo "${GITHUB_REF#refs/tags/}, and ${{env.github_event_ref}}" >> by_the_github_action.txt

- name: stop and remove the previous container
run: |
if docker ps -a | grep -q 'HeXA_Homepage_Backend'; then
if docker ps | grep -q 'HeXA_Homepage_Backend'; then
docker stop HeXA_Homepage_Backend
fi
docker container rm HeXA_Homepage_Backend
fi


- name: build docker image
env:
Vault_Token: ${{ secrets.VAULT_TOKEN }}
run: docker build . --file dockerfile -t HeXA_Homepage_Backend:${GITHUB_REF#refs/tags/} --build-arg VAULT_TOKEN=${{env.Vault_Token}}

- name: run and test
run: |
docker run -d -p 8282:8080 --name HeXA_Homepage_Backend HeXA_Homepage_Backend
test_result="$(docker exec HeXA_Homepage_Backend ./gradlew test)"
second_last_line="$(echo "$test_result" | tail -n 2 | head -n 1)"

if [[ "$second_last_line" =~ ^BUILD\ SUCCESSFUL ]]; then
echo "TEST SUCCESSFUL"
else
docker stop HeXA_Homepage_Backend
docker container rm HeXA_Homepage_Backend
last_version=$(docker images | grep 'HeXA_Homepage_Backend' | awk '{print $2}' | tail -n 2 | head -n 1)
docker run -d -p 8282:8080 --name HeXA_Homepage_Backend HeXA_Homepage_Backend:$last_version
echo "TEST FAILED"
fi


Loading