Github Actions Deploying Generated JAR file

Viewed 3508

I'm new to Github Actions and trying to figure out some basic processing. What I want to do is when I commit to my Java repo, Github Actions triggers a maven build which generates the Java JAR file. I then want to reference the JAR file in the next step of the workflow to deploy via SSH to a Cloud Server.

What I'm missing and can't find any current documentation to, is how I know the location of the generated JAR file when Github is generating it on its temporary VM. Below is the Github Actions script I currently have.

The very bottom portion with "source" is where I'm unsure what to provide.

Thank you.

steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
  uses: actions/setup-java@v1
  with:
    java-version: 1.8
- name: Build with Maven
  run: mvn -B package --file pom.xml
- name: copy file via ssh key
  uses: appleboy/scp-action@master
  env:
    HOST: ${{ secrets.HOST }}
    USERNAME: ${{ secrets.USERNAME }}
    PORT: ${{ secrets.PORT }}
    KEY: ${{ secrets.KEY }}
  with:
    **source: "./bla.jar"**
    target: "/usr/test/"
1 Answers

I believe I solved this. Should have just played with it more. Looks like it is relative to the root github directory path that the maven command is run out of. So, when Maven command was run it created /target directory and placed compiled JAR in that directory.

So was able to simply state with: source: "./target/restapi-0.0.1-SNAPSHOT.jar" target: "/usr/test/"

Related