Skip to content

Delete Dockerfile

Delete Dockerfile #15

Workflow file for this run

name: Java CD with Maven - Prod
on:
push:
branches: [ "main" ]
jobs:
cd-prod:
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: Run Tests With Jacoco Coverage
run: mvn -B -f pom.xml test jacoco:prepare-agent jacoco:report
- name: SonarCloud Analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
mvn -B verify sonar:sonar \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.organization=kelvin-alef \
-Dsonar.projectKey=kelvin-alef_java-api \
-Dsonar.language=java \
-Dsonar.java.coveragePlugin=jacoco \
-Dmaven.test.skip=true
- name: Build The Application
run: mvn -B -f pom.xml clean install -Dmaven.test.skip=true
- name: Configure SSH Azure
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/azure.key
chmod 600 ~/.ssh/azure.key
cat >>~/.ssh/config <<END
Host azure
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/azure.key
StrictHostKeyChecking no
END
env:
SSH_USER: ${{ secrets.SSH_USER_PROD }}
SSH_HOST: ${{ secrets.SSH_HOST_PROD }}
SSH_KEY: ${{ secrets.SSH_KEY_PROD }}
- name: Deploy The Application
run: |
ssh azure 'sudo systemctl stop java-api'
ssh azure 'sudo rm -rf /api/java-api.jar'
scp target/java-api.jar azure:/api/java-api.jar
ssh azure 'sudo systemctl start java-api'