diff --git a/.forgejo/workflows/Run_pull.yaml b/.forgejo/workflows/Run_pull.yaml index 0b8bc7e..99b982d 100644 --- a/.forgejo/workflows/Run_pull.yaml +++ b/.forgejo/workflows/Run_pull.yaml @@ -1,21 +1,26 @@ +name: Deploy to server + on: push: branches: - main - workflow_dispatch: jobs: - run_pull: - name: run pull + deploy: runs-on: ubuntu-latest - + steps: - - name: install ssh keys - run: | - 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 ${{ secrets.WORK_DIR }} && git checkout ${{ secrets.MAIN_BRANCH }} && git pull && exit" - - name: cleanup - run: rm -rf ~/.ssh \ No newline at end of file + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Configure SSH + uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.DEPLOY_KEY }} + + - name: Git Pull + run: | + cd ${{ github.workspace }} + ssh-keyscan -t rsa ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts + ssh ${{ secrets.SSH_USER }}@${{ secrets.SERVER_IP }} "cd ${{ secrets.REPO_PATH }} && git pull origin main" + echo "Successfully pulled repo." \ No newline at end of file