fix cicd #15
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: Docker Image CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build the Docker image | |
run: | | |
docker-compose -f docker-compose.prod.yml build | |
- name: Save the Docker image to tar file | |
run: | | |
docker save -o telegram_gpt_bot_image.tar telegram_gpt_bot_image:latest | |
- name: Copy file via scp | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
port: ${{ secrets.PORT }} | |
key: ${{ secrets.KEY }} | |
# overwrite: true | |
# source: "tests/a.txt,tests/b.txt" | |
source: "docker-compose.prod.yml,telegram_gpt_bot_image.tar" | |
target: "/root/projects/TelegramGPTBot" | |
- name: Executing remote ssh commands | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
port: ${{ secrets.PORT }} | |
key: ${{ secrets.KEY }} | |
script: | | |
docker load --input /root/projects/TelegramGPTBot/telegram_gpt_bot_image.tar | |
docker-compose -f /root/projects/TelegramGPTBot/docker-compose.prod.yml up | |
# - name: Copy tar file to prod server | |
# run: | | |
# # docker save -o $image_path $image_name | |
# - name: Load the Docker image in prod server | |
# run: | | |
# docker load -i $prod_image_path | |
# - name: copy file via ssh password | |
# uses: appleboy/[email protected] | |
# with: | |
# host: ${{ secrets.HOST }} | |
# username: ${{ secrets.USERNAME }} | |
# password: ${{ secrets.PASSWORD }} | |
# port: ${{ secrets.PORT }} | |
# source: "tests/a.txt,tests/b.txt" | |
# target: your_server_target_folder_path | |
# - name: Copy single file to remote | |
# uses: garygrossgarten/github-action-scp@release | |
# with: | |
# local: test/oof.txt | |
# remote: scp/single/oof.txt | |
# host: ${{ secrets.HOST }} | |
# username: ${{ secrets.SSH_USER }} | |
# password: ${{ secrets.PASSWORD }} | |
# delivery: | |
# name: Delivery | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: executing remote ssh commands using password | |
# uses: appleboy/[email protected] | |
# with: | |
# host: ${{ secrets.HOST }} | |
# username: ${{ secrets.USERNAME }} | |
# password: ${{ secrets.PASSWORD }} | |
# port: ${{ secrets.PORT }} | |
# script: whoami |