no dbeaver! #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD Pipeline | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
services: # use docker services for building and pushing compose file inside the repo | |
docker: | |
image: docker:latest | |
options: --privileged | |
steps: | |
- uses: actions/checkout@v4 # use this is an action to check the repo codes | |
- name: Login to DockerHub | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin docker.youwho.club | |
- name: Build and Push | |
run: | | |
docker compose -f "docker-compose.yml" build | |
docker compose -f "docker-compose.yml" push | |
pull-on-server: | |
runs-on: ubuntu-latest | |
needs: build-and-push | |
steps: | |
- name: Deploy to server | |
uses: appleboy/ssh-action@master # use this is an action to login into the ssh | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USER }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
script: | # for none root user the default current directory is /home | |
cd /root/hoopoe | |
docker compose -f "docker-compose.yml" pull | |
docker compose -f "docker-compose.yml" up -d |