From e7d05caf0bebc9464904e337f1b602bafc795b7e Mon Sep 17 00:00:00 2001 From: Heidi Lammi-Mihaljov Date: Mon, 25 Nov 2024 16:53:20 +0200 Subject: [PATCH] =?UTF-8?q?OK-735:=20Kokeillaan=20buildia=20github-actions?= =?UTF-8?q?iss=C3=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 107 ++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b4bee50 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,107 @@ +name: Ovara build workflow + +on: + workflow_dispatch: + push: + paths-ignore: + - '**.md' + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'corretto' + cache: 'maven' + + - name: Build with Maven + env: + GITHUB_TOKEN: ${{ secrets.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