Skip to content

Commit

Permalink
Comment build and deploy stages in CI/CD.
Browse files Browse the repository at this point in the history
  • Loading branch information
TyVik committed Jun 16, 2024
1 parent 9529ad6 commit 9ac202e
Showing 1 changed file with 23 additions and 54 deletions.
77 changes: 23 additions & 54 deletions .github/workflows/ci-cd-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,59 +46,28 @@ jobs:
run: |
pdm run flake8
build:
needs: [test, lint]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: krddev/bot:$GITHUB_REF_TYPE

deploy:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Add SSH key
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Deploy
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} << 'EOF'
docker pull docker.io/krddev/bot:$GITHUB_REF_TYPE
sudo systemctl restart krddevbot.service
EOF
# - name: Add SSH key
# uses: webfactory/ssh-agent@v0.5.3
# build:
# needs: [test, lint]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
#
# - name: Add server to known_hosts
# run: |
# ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
#
# - name: Copy secrets from server
# run: |
# ssh -o StrictHostKeyChecking=no ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} "cat /home/${{ secrets.SERVER_USER }}/tasks/cicd/.env" > .env
#
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Build and push
# uses: docker/build-push-action@v5
# with:
# push: true
# tags: krddev/bot:$GITHUB_REF_TYPE
#
# deploy:
# needs: build-and-test
# needs: [build]
# runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/master'
# steps:
# - name: Add SSH key
# uses: webfactory/ssh-agent@v0.5.3
Expand All @@ -108,8 +77,8 @@ jobs:
# - name: Deploy
# run: |
# ssh -o StrictHostKeyChecking=no ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} << 'EOF'
# podman stop telegram_bot || true
# podman rm telegram_bot || true
# podman pull docker.io/drozdovnikolai/telegram-bot:latest
# podman run -d --name telegram_bot --network="host" docker.io/drozdovnikolai/telegram-bot:latest pdm bot
# EOF
# cd ~/krddevbot
# git pull
# docker build -t krddev/bot:main .
# sudo systemctl restart krddevbot.service
# EOF

0 comments on commit 9ac202e

Please sign in to comment.