Skip to content

Commit

Permalink
OK-735: Lisätään artifactory username ja password settingsiin
Browse files Browse the repository at this point in the history
  • Loading branch information
heidilm committed Nov 26, 2024
1 parent e7d05ca commit 2fc3532
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 84 deletions.
102 changes: 18 additions & 84 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,99 +9,33 @@ on:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2

- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 21
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '21'
java-version: '17'
distribution: 'corretto'
cache: 'maven'

- uses: szenius/[email protected]
with:
timezoneLinux: "Europe/Helsinki"

- name: Build with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
run: |
cd ovara-backend
mvn clean package -B -DskipTests
- uses: actions/cache@v3
id: ci-tools
with:
path: ci-tools
key: ${{ github.sha }}

# deploy_image:
# runs-on: ubuntu-latest
# needs: build
#
# steps:
# - uses: actions/checkout@v3
#
# - uses: actions/cache@v3
# id: restore-build
# with:
# path: |
# kouta-backend/target
# ovara-kouta/target
# key: ${{ github.sha }}
#
# - uses: actions/cache@v3
# id: ci-tools
# with:
# path: ci-tools
# key: ${{ github.sha }}
#
# - name: Build Docker container
# shell: bash
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# run: |
# set -euo pipefail
# export ARTIFACT_NAME="kouta-backend"
# export OVARA_EXPORTER_NAME="ovara-kouta"
# export BASE_IMAGE="baseimage-fatjar-openjdk11:master"
# source ci-tools/common/setup-tools.sh
#
# mv kouta-backend/target/kouta-backend-*-jar-with-dependencies.jar $DOCKER_BUILD_DIR/artifact/${ARTIFACT_NAME}.jar
# cp -vr kouta-backend/src/main/resources/* $DOCKER_BUILD_DIR/config/
# ./ci-tools/common/pull-image.sh
# ./ci-tools/github-build/build-fatjar.sh $ARTIFACT_NAME
#
# ./ci-tools/common/clean-docker-build-dir.sh
#
# mv ovara-kouta/target/ovara-kouta-*-jar-with-dependencies.jar $DOCKER_BUILD_DIR/artifact/${OVARA_EXPORTER_NAME}.jar
# cp -vr ovara-kouta/src/main/resources/* $DOCKER_BUILD_DIR/config/
# cp -v kouta-backend/src/main/resources/oph-configuration/kouta-backend.properties.template $DOCKER_BUILD_DIR/config/oph-configuration/
# cat $DOCKER_BUILD_DIR/config/oph-configuration/ovara-kouta.additional.properties.template $DOCKER_BUILD_DIR/config/oph-configuration/kouta-backend.properties.template
# rm $DOCKER_BUILD_DIR/config/oph-configuration/ovara-kouta.additional.properties.template
# ./ci-tools/common/pull-image.sh
# ./ci-tools/github-build/build-fatjar.sh $OVARA_EXPORTER_NAME
#
# ./ci-tools/github-build/upload-image.sh $ARTIFACT_NAME
# ./ci-tools/github-build/upload-image.sh $OVARA_EXPORTER_NAME
#
# deploy_to_artifactory:
# runs-on: ubuntu-latest
# needs: build
# if: github.ref == 'refs/heads/master'
#
# steps:
# - uses: actions/checkout@v3
#
# - uses: actions/cache@v3
# id: ci-tools
# with:
# path: ci-tools
# key: ${{ github.sha }}
#
# - name: Deploy to artifactory
# env:
# ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
# ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
# run: mvn deploy -DskipTests --settings ci-tools/common/maven-settings.xml
41 changes: 41 additions & 0 deletions ovara-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,47 @@
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>

<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/opetushallitus/packages</url>
<releases>
<enabled>false</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
<repository>
<id>oph-sade-artifactory-snapshots</id>
<url>https://artifactory.opintopolku.fi/artifactory/oph-sade-snapshot-local</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>oph-sade-artifactory-releases</id>
<url>https://artifactory.opintopolku.fi/artifactory/oph-sade-release-local</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>repository.jboss.org</id>
<name>JBoss Repository</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
Expand Down
11 changes: 11 additions & 0 deletions ovara-backend/settings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!-- Maven settings -tiedosto CI-buildia varten, tarvitaan jotta voidaan autentikoitua Github Packages -repoon -->

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
Expand Down Expand Up @@ -29,5 +30,15 @@
<username>private-token</username>
<password>${env.GITHUB_TOKEN}</password>
</server>
<server>
<id>oph-sade-artifactory</id>
<username>${env.ARTIFACTORY_USERNAME}</username>
<password>${env.ARTIFACTORY_PASSWORD}</password>
</server>
<server>
<id>oph-nexus</id>
<username>${env.ARTIFACTORY_USERNAME}</username>
<password>${env.ARTIFACTORY_PASSWORD}</password>
</server>
</servers>
</settings>

0 comments on commit 2fc3532

Please sign in to comment.