diff --git a/.github/workflows/springboot-on-push.yaml b/.github/workflows/springboot-on-push.yaml index 10726396..7ccb5467 100644 --- a/.github/workflows/springboot-on-push.yaml +++ b/.github/workflows/springboot-on-push.yaml @@ -33,11 +33,17 @@ jobs: - name: Test with Gradle run: ./gradlew test - # Deploy - - name: Set up SSH + # Setup SSH + - name: Set up SSH agent with private key uses: webfactory/ssh-agent@v0.5.4 with: ssh-private-key: ${{ secrets.SPRINGBOOT_EC2_SSH_KEY }} + - name: Add remote server to known hosts + run: | + mkdir -p ~/.ssh + ssh-keyscan -H ${{ secrets.SPRINGBOOT_HOST_DNS }} >> ~/.ssh/known_hosts + + # Deploy - name: SCP jar file to server run: | scp *jar ${{ secrets.SPRINGBOOT_USERNAME }}@${{ secrets.SPRINGBOOT_HOST_DNS }}:~/\