From 1b3888726ebf30324801f5ecd9e6969e861d17b6 Mon Sep 17 00:00:00 2001 From: Jesse Gorzinski <17914061+ThePrez@users.noreply.github.com> Date: Fri, 8 Jul 2022 21:48:12 -0500 Subject: [PATCH] add some GitHub actions --- .github/workflows/build-release.yml | 48 +++++++++++++++++++++++++++++ .github/workflows/maven-ci.yml | 28 +++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 .github/workflows/build-release.yml create mode 100644 .github/workflows/maven-ci.yml diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000..a90eab2 --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,48 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: Build new release +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + cache: maven + + - name: Build with Maven + run: mvn -B package --file pom.xml + - name: Grab bundled jar + run: mv target/*with-dependencies.jar ./prom-client-ibmi.jar + - name: Create the release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + - name: Upload .jar file to release + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./prom-client-ibmi.jar + asset_name: prom-client-ibmi.jar + asset_content_type: application/zip diff --git a/.github/workflows/maven-ci.yml b/.github/workflows/maven-ci.yml new file mode 100644 index 0000000..69c336d --- /dev/null +++ b/.github/workflows/maven-ci.yml @@ -0,0 +1,28 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: Java CI with Maven + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + cache: maven + - name: Build with Maven + run: mvn -B package --file pom.xml + - name: Generate Javadoc + run: mvn -B javadoc:javadoc --file pom.xml