diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9531785..29972be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,51 +6,25 @@ on: - main jobs: - build: + build_and_deploy: runs-on: ubuntu-latest + container: + image: maven:3.9.6-eclipse-temurin-17 steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Install Maven - run: | - apt-get update - apt-get install -y maven - - - name: Set up Java 17 - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 17 - cache: maven - - name: Build with Maven run: mvn -B clean package - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: auction - path: target/*.jar - - deploy: - needs: build - runs-on: ubuntu-latest - - steps: - - name: Download artifact - uses: actions/download-artifact@v4 - with: - name: auction - - - name: Copy to server + - name: Copy jar to server uses: appleboy/scp-action@v0.1.7 with: host: ${{ secrets.SERVER_IP }} username: ${{ secrets.SERVER_USER }} key: ${{ secrets.SERVER_SSH_KEY }} - source: "*.jar" + source: "target/*.jar" target: "/opt/auction/app.jar" - name: Restart service @@ -61,4 +35,3 @@ jobs: key: ${{ secrets.SERVER_SSH_KEY }} script: | sudo systemctl restart auction - echo "Deployment complete"