This commit is contained in:
1 parent
1396ad3bd8
commit
d8806542c2
1 file changed
+9
-7
@@ -5,22 +5,24 @@ on:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: canina
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: sh
|
||||
steps:
|
||||
- name: Install SSH
|
||||
run: |
|
||||
V=$(cut -d'.' -f1-2 /etc/alpine-release)
|
||||
echo "http://dl-cdn.alpinelinux.org/alpine/v$V/main" > /etc/apk/repositories
|
||||
echo "http://dl-cdn.alpinelinux.org/alpine/v$V/community" >> /etc/apk/repositories
|
||||
apk add --no-cache openssh-client
|
||||
- name: Setup SSH key
|
||||
env:
|
||||
SSH_KEY: ${{ secrets.DEPLOY_KEY }}
|
||||
run: |
|
||||
HOST_IP=$(ip route | grep default | cut -d' ' -f3)
|
||||
mkdir -p ~/.ssh
|
||||
echo "$SSH_KEY" > ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
ssh-keyscan -p 2234 -H "$HOST_IP" >> ~/.ssh/known_hosts
|
||||
echo "Host IP: $HOST_IP"
|
||||
ssh-keyscan -p 2234 -H 172.17.0.1 >> ~/.ssh/known_hosts
|
||||
- name: Deploy
|
||||
run: |
|
||||
HOST_IP=$(ip route | grep default | cut -d' ' -f3)
|
||||
ssh -p 2234 devops@$HOST_IP 'bash /opt/services/scripts/depcanina.sh main'
|
||||
run: ssh -p 2234 devops@172.17.0.1 'bash /opt/services/scripts/depcanina.sh main'
|
||||
Reference in new issue
Block a user