Home > front end >  How to run the build in GitHub Actions itself?
How to run the build in GitHub Actions itself?

Time:01-02

name: demo
on:
  push:
    branches:
      - 'pipeline-dev'

jobs:
  conditional_step:
    runs-on: 'ubuntu-20.04'
    steps:
    - uses: actions/checkout@v3
      with:
        repository: hello-world-with-gradle
    - run: cd /home/runner/work/test-actions/test-actions
    - uses: actions/setup-java@v3
      with:
        distribution: temurin
        java-version: 8
        
    - name: Setup Gradle
      uses: gradle/gradle-build-action@v2
    
    - name: Execute Gradle build
      run: ./gradlew build
    

The above workflow gives a JAR as as a build for Application. Now do we have the capabilities to run this JAR in the workflow itself? like

- run: Java -jar hello-world-0.1.0.jar   // This gives an error

In our real use case we want to run the utility in pipeline and send its output result to other google bucket.

Tried out various java actions plugins but not able to run JAR yet. If anyone know how to run a JAR or any other alternative It would be helpful.

CodePudding user response:

check if the case matters, use java, not Java:

- run: java -jar hello-world-0.1.0.jar 
      ^^^

That way, the GitHub runner should find and execute java after applying actions/setup-java.

  • Related