Skip to content

Merge pull request #38 from bsimmons123/snyk-upgrade-3b0cfbb30a8becdb… #35

Merge pull request #38 from bsimmons123/snyk-upgrade-3b0cfbb30a8becdb…

Merge pull request #38 from bsimmons123/snyk-upgrade-3b0cfbb30a8becdb… #35

Workflow file for this run

name: Release - Test, Build & Redeploy
on:
workflow_dispatch:
push:
jobs:
test:
name: Test - Unit & Integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17.0.9
- name: Gradle Tests
run: ./gradlew clean test
docker:
name: Publish - Docker Hub
runs-on: ubuntu-latest
needs: [test]
env:
REPO: ${{ secrets.DOCKER_REPO }}
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v1
- name: Login to Docker Hub
run: docker login -u ${{ secrets.DOCKER_USER }}
-p '${{ secrets.DOCKER_PASS }}'
- name: Build Docker image
run: |
echo "REPO - $REPO"
echo "GITHUB_SHA (first 8 characters) - ${GITHUB_SHA::8}"
docker build -t $REPO:latest -t $REPO:${GITHUB_SHA::8} .
- name: Publish Docker image
run: docker push $REPO
remote-deploy:
runs-on: ubuntu-latest
needs: [ docker ]
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master'
steps:
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
name: id_rsa # optional
known_hosts: ${{ secrets.SSH_HOST }}
# config: ${{ secrets.CONFIG }} # ssh_config; optional
if_key_exists: fail # replace / ignore / fail; optional (defaults to fail)
- name: rsync over SSH
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_ADDRESS }} "cd ../invstore-jvm && ./redeploy.sh"