diff --git a/.github/workflows/release-artifacts.yml b/.github/workflows/release-artifacts.yml new file mode 100644 index 0000000000..7b75805f56 --- /dev/null +++ b/.github/workflows/release-artifacts.yml @@ -0,0 +1,54 @@ +name: Build and attach JAR and WAR artifacts to release + +on: + release: + types: [ created ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: '17' + + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Checkout + uses: actions/checkout@v2.2.0 + with: + fetch-depth: 0 + + - name: Build JAR + run: mvn clean package -DskipTests + + - name: Attach JAR to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ors-api/target/ors.jar + asset_name: ors.jar + asset_content_type: application/java-archive + + - name: Build WAR + run: mvn clean package -DskipTests -PbuildWar + + - name: Attach WAR to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ors-api/target/ors.war + asset_name: ors.war + asset_content_type: application/java-archive diff --git a/.github/workflows/vulnerability-scanning.yml b/.github/workflows/vulnerability-scanning.yml index 4ddf755fb6..e7f8fbc943 100644 --- a/.github/workflows/vulnerability-scanning.yml +++ b/.github/workflows/vulnerability-scanning.yml @@ -27,8 +27,8 @@ jobs: steps: - run: | echo "Publish environment variables" - Anchore-War-Build-Scan: - name: Grype scan war file + Anchore-Jar-War-Build-Scan: + name: Grype scan jar and war file runs-on: ubuntu-latest permissions: actions: read @@ -51,11 +51,13 @@ jobs: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 - - name: Build war file + - name: Build jar and war file run: | mvn -B package -DskipTests -DCI=true - # Copy the .war file to a custom location where grype can find it + # Copy the .jar file to a custom location where grype can find it mkdir -p ors-api/target/grype + cp ors-api/target/ors.jar ors-api/target/grype/ors.jar + mvn -B package -DskipTests -PbuildWar -DCI=true cp ors-api/target/ors.war ors-api/target/grype/ors.war - name: Run the Anchore Grype scan action to console uses: anchore/scan-action@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f26c9e8ac..706864ac7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ RELEASING: - new backend documentation using VitePress([#1617](https://github.com/GIScience/openrouteservice/pull/1617)) - support for Norwegian language ([#1645](https://github.com/GIScience/openrouteservice/pull/1645)) - support for mmap dataaccess mode ([#1649](https://github.com/GIScience/openrouteservice/pull/1649)) +- JAR & WAR artifacts for new releases ([#1669](https://github.com/GIScience/openrouteservice/pull/1669)) ### Changed - default branch from `master` to `main` diff --git a/ors-api/pom.xml b/ors-api/pom.xml index 2dd5d301f0..3befe396b3 100644 --- a/ors-api/pom.xml +++ b/ors-api/pom.xml @@ -43,9 +43,9 @@ - war + jar @@ -295,15 +295,15 @@ war - - true - buildFatJar jar + + true + apitests diff --git a/ors-report-aggregation/pom.xml b/ors-report-aggregation/pom.xml index ffc8aabb9c..715376e981 100644 --- a/ors-report-aggregation/pom.xml +++ b/ors-report-aggregation/pom.xml @@ -23,7 +23,7 @@ org.heigit.ors ors-api ${project.version} - war + jar