Skip to content

Commit

Permalink
5/12: migrate upload file to cloudinary
Browse files Browse the repository at this point in the history
  • Loading branch information
thuan committed Dec 5, 2023
1 parent 7d9441f commit 0817cdc
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,52 @@ jobs:
run: docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_PASSWORD}}
- name: Build project and push to dockerhub
run: mvn clean install jib:build
deploy:
needs: build
runs-on: [ azure ]
steps:
- name: Check if directory exists
id: check_directory
run: |
if [ -d spotify ]; then
echo "Directory 'spotify' exists."
echo "::set-output name=directory_exists::true"
else
echo "Directory 'spotify' does not exist."
echo "::set-output name=directory_exists::false"
fi
- name: Clone or update repository
if: steps.check_directory.outputs.directory_exists == 'false'
run: |
git clone ${{secrets.GIT_REPO_SPOTIFY}} spotify
cd spotify
- name: Remove existing directory and clone again
if: steps.check_directory.outputs.directory_exists == 'true'
run: |
rm -rf spotify
git clone ${{secrets.GIT_REPO_SPOTIFY}} spotify
cd spotify
- name: Check if Docker Compose project is running
id: check_docker_compose
run: |
if docker-compose --project-name spotify-server ps | grep -q "Up"; then
echo "Docker Compose project 'spotify-server' is running."
echo "::set-output name=docker_compose_running::true"
else
echo "Docker Compose project 'spotify-server' is not running."
echo "::set-output name=docker_compose_running::false"
fi
- name: Stop and remove Docker Compose project if running
if: steps.check_docker_compose.outputs.docker_compose_running == 'true'
run: |
sudo docker-compose --project-name spotify-server down
- name: Run server with Docker Compose
run: sudo docker-compose --project-name spotify-server up



0 comments on commit 0817cdc

Please sign in to comment.