Release Version #30
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
name: Release Version | |
on: | |
workflow_dispatch: | |
inputs: | |
release_version: | |
description: "The Version of the Release (e.g. 0.1.0)" | |
required: false | |
default: "" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- 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: Configure Git user | |
run: | | |
git config user.email "actions@dipa.online" | |
git config user.name "DiPA GitHub Actions" | |
- name: Einstellen des Autorisierungstoken | |
run: | | |
npm config set //npm.pkg.github.com/:_authToken=${{ secrets.GIT_HUB_PACKAGES_ACCESS_TOKEN_WRITE }} | |
- 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: 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 | |
run: | | |
git checkout -f main | |
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 production-ci -B -DskipTests clean install --file pom.xml | |
scp server/target/deployment/*.yaml dipa-deployment@dipa.rz-housing.tu-clausthal.de:pa-deployment/main | |
ssh dipa-deployment@dipa.rz-housing.tu-clausthal.de kubectl apply -k pa-deployment/main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
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 }} |