Skip to content

Commit

Permalink
ci: release artifacts (#1669)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGreatRefrigerator authored Feb 13, 2024
2 parents 9b54204 + 7c84d24 commit d025605
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 10 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/release-artifacts.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
10 changes: 6 additions & 4 deletions .github/workflows/vulnerability-scanning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
10 changes: 5 additions & 5 deletions ors-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
<!--
A default for packagingValue is needed, if profiles other than buildWar or buildFatJar are used, e.g. apitests.
The value is set/overridden in the profiles buildWar and buildFatJar, e.g.
mvn clean install -P buildFatJar
mvn clean package -PbuildWar
-->
<packagingValue>war</packagingValue>
<packagingValue>jar</packagingValue>
</properties>

<build>
Expand Down Expand Up @@ -295,15 +295,15 @@
<properties>
<packagingValue>war</packagingValue>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>buildFatJar</id>
<properties>
<packagingValue>jar</packagingValue>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>apitests</id>
Expand Down
2 changes: 1 addition & 1 deletion ors-report-aggregation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<groupId>org.heigit.ors</groupId>
<artifactId>ors-api</artifactId>
<version>${project.version}</version>
<type>war</type>
<type>jar</type>
</dependency>
</dependencies>

Expand Down

0 comments on commit d025605

Please sign in to comment.