Skip to content

Just build and test needed modules and their deps in otc github acti… #7

Just build and test needed modules and their deps in otc github acti…

Just build and test needed modules and their deps in otc github acti… #7

Workflow file for this run

name: Push images on dev branch update about otc project
on:
push:
branches:
- Automatic_deployment
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
java: [ 17 ]
name: Build OPEX and run tests with java ${{ matrix.java }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-package: jdk
java-version: ${{ matrix.java }}
# cache: maven
- name: Build
run: mvn -pl wallet,bc-gateway,common -amd -B -T 1C clean install -Potc
- name: Run Tests
run: mvn -pl wallet,bc-gateway,common -amd -B -T 1C -Dskip.unit.tests=false surefire:test
- name: Build Docker images
env:
TAG: otc-dev
run: docker-compose -f docker-compose-otc.build.yml build
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push images to GitHub Container Registry
env:
TAG: otc-dev
run: docker-compose -f docker-compose-otc.build.yml push
deploy:
name: deploy docker-compose on remote host
runs-on: ubuntu-20.04
needs: build
steps:
- name: set ssh keys
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{secrets.SSH_PRIVATE_KEY}}" > ~/.ssh/id_rsa
ssh-keyscan -H ${{secrets.SSH_HOST}} >~/.ssh/known_hosts
- name: pull docker images in dest server
run: |
ssh ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} "cd ${{secrets.SSH_DIR}} && docker-compose -f docker-compose-otc.yml -f docker-compose-otc.override.yml -f docker-compose-otc.build.yml -f docker-compose-otc.local.yml up --build -d && exit "