Delete cd-homolog.yml #9
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: CD | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
CD: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
cache: maven | |
- name: Build The Application | |
run: mvn -B -f pom.xml clean install -Dmaven.test.skip=true | |
- name: Configure SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_KEY" > ~/.ssh/remote.key | |
chmod 600 ~/.ssh/remote.key | |
cat >>~/.ssh/config <<END | |
Host remote | |
HostName $SSH_HOST | |
User $SSH_USER | |
IdentityFile ~/.ssh/remote.key | |
StrictHostKeyChecking no | |
END | |
env: | |
SSH_HOST: ${{ secrets.SSH_HOST }} | |
SSH_USER: ${{ secrets.SSH_USER }} | |
SSH_KEY: ${{ secrets.SSH_KEY }} | |
- name: Deploy The Application | |
run: | | |
ssh remote 'sudo rm -rf /api/java-api.jar' | |
scp target/java-api.jar remote:/api/java-api.jar |