This commit is contained in:
Fiky B 2024-01-25 08:59:43 +07:00
parent b17f0c1410
commit 7de11bbea6

View File

@ -8,18 +8,16 @@ jobs:
run_pull:
name: run pull
runs-on: ubuntu-latest
environment: ssh_key
steps:
- name: install ssh keys
# check this thread to understand why its needed:
# https://stackoverflow.com/a/70447517
run: |
echo "${{ secrets.SSH_HOST }}"
echo '${{ secrets.SSH_USER }}'
echo ${{ vars.WORK_DIR }}
# ssh-keyscan -H ${{ env.SSH_HOST }} > ~/.ssh/known_hosts
# - name: connect and pull
# run: ssh ${{ env.SSH_USER }}@${{ env.SSH_HOST }} "cd ${{ env.WORK_DIR }} && git checkout ${{ env.MAIN_BRANCH }} && git pull && exit"
# - name: cleanup
# run: rm -rf ~/.ssh
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SSH_HOST }} > ~/.ssh/known_hosts
- name: connect and pull
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd ${{ vars.WORK_DIR }} && git checkout main && git pull && exit"
- name: cleanup
run: rm -rf ~/.ssh