Skip to content

Merge remote-tracking branch 'refs/remotes/origin/develop' into fix/p… #1491

Merge remote-tracking branch 'refs/remotes/origin/develop' into fix/p…

Merge remote-tracking branch 'refs/remotes/origin/develop' into fix/p… #1491

Workflow file for this run

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
push:
branches:
- "**"
- "!main"
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v2.1.5
with:
node-version: 14.x
registry-url: "https://npm.pkg.github.com"
scope: "@dipa-projekt"
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: "17"
architecture: x64
- name: Cache local Maven repository
uses: actions/cache@v2.1.6
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Cache Frontend Build Node Modules
uses: actions/cache@v2.1.6
with:
path: client/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache SonarCloud packages
uses: actions/cache@v2.1.6
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build & Analyze with Maven
run: mvn -s .mvn/settings.xml -P develop-ci -Ddocker.skip.build=true -B clean install org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --file pom.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GIT_HUB_USERNAME: ${{ secrets.GIT_HUB_USERNAME }}
GIT_HUB_PACKAGES_ACCESS_TOKEN: ${{ secrets.GIT_HUB_PACKAGES_ACCESS_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GIT_HUB_PACKAGES_ACCESS_TOKEN }}
- name: Deployment to Kubernetes
if: github.ref == 'refs/heads/develop'
run: |
mkdir -p ~/.m2
cp .mvn/settings-security.xml ~/.m2
mkdir -p ~/.ssh
echo -e "${{ secrets.DEPLOYMENT_SSH_KEY }}" > ~/.ssh/id_rsa
echo -e "${{ secrets.DEPLOYMENT_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
chmod 600 ~/.ssh/id_rsa
mvn -s .mvn/settings.xml -P develop-ci -B -DskipTests install docker:push --file pom.xml
scp server/target/deployment/*.yaml dipa-deployment@dipa.rz-housing.tu-clausthal.de:pa-deployment/develop
ssh dipa-deployment@dipa.rz-housing.tu-clausthal.de kubectl apply -k pa-deployment/develop
env:
DOCKER_REGISTRY_USERNAME: dipa
DOCKER_REGISTRY_TOKEN: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
GIT_HUB_USERNAME: ${{ secrets.GIT_HUB_USERNAME }}
GIT_HUB_PACKAGES_ACCESS_TOKEN: ${{ secrets.GIT_HUB_PACKAGES_ACCESS_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GIT_HUB_PACKAGES_ACCESS_TOKEN }}