Merge remote-tracking branch 'origin/test' into test #1581
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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_WRITE }} | |
NODE_AUTH_TOKEN: ${{ secrets.GIT_HUB_PACKAGES_ACCESS_TOKEN_WRITE }} | |
- 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_WRITE }} | |
NODE_AUTH_TOKEN: ${{ secrets.GIT_HUB_PACKAGES_ACCESS_TOKEN_WRITE }} |