Skip to content

Bump braces from 3.0.2 to 3.0.3 in /frontend-client #203

Bump braces from 3.0.2 to 3.0.3 in /frontend-client

Bump braces from 3.0.2 to 3.0.3 in /frontend-client #203

Workflow file for this run

name: Minimal CI/CD
on: [push]
jobs:
tests:
name: Testing
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Run docker-compose
run: docker-compose up -d
- name: Set up Open JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- 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: Test backend
run: mvn -B clean test -pl :backend-server
- name: Set up Node 14
uses: actions/setup-node@v2-beta
with:
node-version: '14'
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Test frontend
run: |
npm install frontend-client --prefix ./frontend-client
npm --prefix frontend-client run test:unit
deploy:
name: Deploy on server
runs-on: ubuntu-latest
needs: tests
if: github.ref == 'refs/heads/master'
env:
KILL_JAVA_SH: ${{ github.workspace }}/ci/kill_java_process.sh
JAVA_CMD_PATH: ~/jdk/bin/java
JAR_NAME: backend-server-
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Set up Node 14
uses: actions/setup-node@v2-beta
with:
node-version: '14'
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Build frontend
run: |
npm install frontend-client --prefix ./frontend-client
npm --prefix frontend-client run build
- name: Create version
run: |
APP_RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
APP_RELEASE_VERSION=${APP_RELEASE_VERSION%"-SNAPSHOT"}
APP_RELEASE_VERSION_ARRAY=(${APP_RELEASE_VERSION//./ })
APP_RELEASE_VERSION_MINOR=APP_RELEASE_VERSION_ARRAY[2]
APP_RELEASE_VERSION_MINOR=$((APP_RELEASE_VERSION_MINOR + 1))
APP_RELEASE_VERSION="${APP_RELEASE_VERSION_ARRAY[0]}.${APP_RELEASE_VERSION_ARRAY[1]}.${APP_RELEASE_VERSION_MINOR}"
echo "JAR_NAME=$JAR_NAME$APP_RELEASE_VERSION-SNAPSHOT.jar" >> $GITHUB_ENV
echo "RELEASE VERSION: ${APP_RELEASE_VERSION}-SNAPSHOT"
mvn -B --batch-mode release:update-versions -DdevelopmentVersion=$APP_RELEASE_VERSION-SNAPSHOT
- name: Cache maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build backend
run: mvn -B clean package -Dmaven.test.skip=true -pl :backend-server
- name: Prepare SSH Keys
run: |
mkdir -p ~/.ssh
echo "${{ secrets.CLIENT_PRIV_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "${{ secrets.SERVER_PUB_KEY }}" > ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts
- name: Kill java process
run: |
ssh -p ${{ secrets.PORT }} ${{ secrets.USERNAME }}@${{ secrets.HOST }} 'bash -s' < $KILL_JAVA_SH
- name: Remove old artifacts
run: |
ssh -p ${{ secrets.PORT }} ${{ secrets.USERNAME }}@${{ secrets.HOST }} "rm -rf backend-server-*.jar"
- name: Copy jar to server
run: |
rsync -avzhe 'ssh -p ${{ secrets.PORT }}' ${{ github.workspace }}/backend-server/target/$JAR_NAME ${{ secrets.USERNAME }}@${{ secrets.HOST }}:~
- name: Launch app
run: |
ssh -f -p ${{ secrets.PORT }} ${{ secrets.USERNAME }}@${{ secrets.HOST }} "$JAVA_CMD_PATH -Xms64M -Xmx256M -jar $JAR_NAME &"
- name: Commit version
run: |
git config --global user.name 'Nicolas Vargas Ortega'
git config --global user.email 'soasada@users.noreply.github.com'
git commit -am "CI/CD: $JAR_NAME artifact deployed"
git push