Skip to content

engine_deploy

engine_deploy #442

Workflow file for this run

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Run Tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
repository_dispatch:
types: [ "engine_deploy", "ui_deploy" ]
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Generate settings.xml for Maven Builds
uses: whelk-io/maven-settings-xml-action@v20
with:
repositories: '[{ "id": "github", "url": "https://maven.pkg.github.com/flexmodel-projects/flexmodel-maven-packages", "snapshots": { "enabled" : true } }]'
plugin_repositories: '[{ "id": "github", "url": "https://maven.pkg.github.com/flexmodel-projects/flexmodel-maven-packages", "snapshots": { "enabled" : true } }]'
servers: '[{ "id": "github", "username": "cjbi", "password": "${{ secrets.MAVEN_TOKEN }}" }]'
- name: Run tests with Maven
run: |
mvn -B -U deploy
- name: Caching Maven Dependencies
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
push-image:
name: Push docker image
needs: [ test ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Generate settings.xml for Maven Builds
uses: whelk-io/maven-settings-xml-action@v20
with:
repositories: '[{ "id": "github", "url": "https://maven.pkg.github.com/flexmodel-projects/flexmodel-maven-packages", "snapshots": { "enabled" : true } }]'
servers: '[{ "id": "github", "username": "cjbi", "password": "${{ secrets.MAVEN_TOKEN }}" }]'
- name: Build Image with Maven
run: |
mvn -B -U -Dmaven.test.skip=true clean package -Dquarkus.container-image.build=true -Dquarkus.container-image.push=true -Dquarkus.container-image.image=cjbi/flexmodel:latest -Dquarkus.container-image.username=${{ secrets.DOCKER_USERNAME }} -Dquarkus.container-image.password=${{ secrets.DOCKER_PASSWORD }}
- name: Caching Maven Dependencies
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
deploy:
runs-on: ubuntu-latest
needs: [ push-image ]
steps:
- name: Deploy Docker Image
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.SSH_USER }}
port: ${{ secrets.SSH_PORT }}
key: ${{ secrets.SSH_KEY }}
command_timeout: 10m
script: |
cd /opt/flexmodel-quickstarts/docker-compose
docker-compose pull flexmodel
docker-compose up -d