Skip to content

fix: pom.xml to reduce vulnerabilities #24

fix: pom.xml to reduce vulnerabilities

fix: pom.xml to reduce vulnerabilities #24

Workflow file for this run

name: Tarjonta-service
on:
workflow_dispatch:
push:
paths-ignore:
- '**.md'
jobs:
test-and-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'corretto'
- uses: actions/setup-node@v4
with:
node-version: 8.12.0
- uses: szenius/[email protected]
with:
timezoneLinux: "Europe/Helsinki"
- name: Build with Maven
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
node -v
npm -v
mvn clean package -B -Dbranch=${GITHUB_REF_NAME} -Drevision=${GITHUB_SHA} -DbuildNumber=${GITHUB_RUN_NUMBER}
node -v
npm -v
- uses: actions/cache@v4
id: restore-build
with:
path: |
target
tarjonta-api/target
tarjonta-app/target
tarjonta-app-angular/target
tarjonta-service/target
tarjonta-shared/target
key: ${{ github.sha }}
deploy-container:
needs: test-and-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: restore-build
with:
path: |
target
tarjonta-api/target
tarjonta-app/target
tarjonta-app-angular/target
tarjonta-service/target
tarjonta-shared/target
key: ${{ github.sha }}
- name: Build and deploy Docker container
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
git clone https://github.com/Opetushallitus/ci-tools.git
source ci-tools/common/setup-tools.sh
export ARTIFACT_NAME="tarjonta"
export TZ=Europe/Helsinki
mv tarjonta-service/target/tarjonta-service.war $DOCKER_BUILD_DIR/artifact/tarjonta-service.war
mv tarjonta-app/target/tarjonta-app-*.war $DOCKER_BUILD_DIR/artifact/tarjonta-app.war
cp -vr src/main/resources/oph-configuration $DOCKER_BUILD_DIR/config/
export BASE_IMAGE="baseimage-war-openjdk8:master"
./ci-tools/common/pull-image.sh
./ci-tools/github-build/build-war.sh $ARTIFACT_NAME
./ci-tools/github-build/upload-image.sh $ARTIFACT_NAME
deploy-jar-library:
needs: test-and-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: restore-build
with:
path: |
target
tarjonta-api/target
tarjonta-app/target
tarjonta-app-angular/target
tarjonta-service/target
tarjonta-shared/target
key: ${{ github.sha }}
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'corretto'
- name: Deploy jar library
if: github.ref == 'refs/heads/master'
shell: bash
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
run: |
git clone https://github.com/Opetushallitus/ci-tools.git
source ci-tools/common/setup-tools.sh
mvn deploy -pl tarjonta-api,tarjonta-shared -DskipTests --settings ci-tools/common/maven-settings.xml