try: should I run the ssh-agent in the same step as adding the ssh key ? #4
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: Copy website to the development site | |
on: | |
push: | |
branches: | |
- cicd_dev | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
copy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install and start the ssh agent | |
run: | | |
which ssh-agent || ( apt-get install -qq openssh-client ) | |
eval $(ssh-agent -s) | |
- name: Read the ssh private key | |
env: | |
SSH_SECRET_KEY: ${{ secrets.private_key }} | |
run: | | |
eval $(ssh-agent -s) | |
ssh-add <(echo "$SSH_SECRET_KEY" | base64 --decode) | |
- name: Definition of the known host | |
run: | | |
mkdir -p ~/.ssh/ | |
# ssh-keyscan 129.199.194.59 > .deploy/known_host | |
mv .deploy/known_hosts ~/.ssh/ | |
chmod 644 ~/.ssh/known_hosts | |
- name: Synchronization of the remote deployment | |
run: | | |
ssh [email protected] "sudo service taxplorer-dev.uwsgi stop" | |
#ssh [email protected] "cd /opt/d4g/12_taxobservatory_dataviz_dev && git pull" | |
ssh [email protected] "sudo service taxplorer-dev.uwsgi start" |