Skip to content

Commit 915be09

Browse files
committed
fix: убран SSH_PASSPHRASE
1 parent dff0d35 commit 915be09

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

.github/workflows/main.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646
name: Push Docker image to DockerHub
4747
runs-on: ubuntu-latest
4848
needs: tests
49+
env:
50+
DJANGO_SECRET_KEY: ${{ secrets.DJANGO_SECRET_KEY }}
4951
steps:
5052
- name: Check out the repo
5153
uses: actions/checkout@v3
@@ -127,22 +129,27 @@ jobs:
127129
- build_and_push_to_docker_hub
128130
- build_frontend_and_push_to_docker_hub
129131
- build_gateway_and_push_to_docker_hub
132+
if: github.ref == 'refs/heads/main'
133+
env:
134+
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
135+
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
136+
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
137+
DB_HOST: ${{ secrets.DB_HOST }}
138+
DB_PORT: ${{ secrets.DB_PORT }}
139+
DJANGO_SECRET_KEY: ${{ secrets.DJANGO_SECRET_KEY }}
140+
DJANGO_DEBUG: ${{ secrets.DJANGO_DEBUG }}
141+
DJANGO_ALLOWED_HOSTS: ${{ secrets.DJANGO_ALLOWED_HOSTS }}
130142
steps:
131143
- name: Checkout repo
132144
uses: actions/checkout@v3
133145

134-
- name: Setup SSH key with passphrase
135-
run: |
136-
eval "$(ssh-agent -s)"
137-
echo "${{ secrets.SSH_KEY }}" > key.pem
138-
chmod 600 key.pem
139-
ssh-add key.pem <<< "${{ secrets.SSH_PASSPHRASE }}"
140-
141146
- name: Copy docker-compose.yml via ssh
142147
uses: appleboy/scp-action@master
143148
with:
144149
host: ${{ secrets.HOST }}
145150
username: ${{ secrets.USER }}
151+
key: ${{ secrets.SSH_KEY }}
152+
passphrase: ${{ secrets.SSH_PASSPHRASE }}
146153
source: "docker-compose.production.yml"
147154
target: "kittygram"
148155

@@ -151,6 +158,8 @@ jobs:
151158
with:
152159
host: ${{ secrets.HOST }}
153160
username: ${{ secrets.USER }}
161+
key: ${{ secrets.SSH_KEY }}
162+
passphrase: ${{ secrets.SSH_PASSPHRASE }}
154163
script: |
155164
cd kittygram
156165
sudo docker compose -f docker-compose.production.yml pull
@@ -169,4 +178,4 @@ jobs:
169178
with:
170179
to: ${{ secrets.TELEGRAM_TO }}
171180
token: ${{ secrets.TELEGRAM_TOKEN }}
172-
message: Деплой успешно выполнен!
181+
message: Деплой успешно выполнен!

0 commit comments

Comments
 (0)