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