Skip to content

Client: display data from 2022 by default #78

Client: display data from 2022 by default

Client: display data from 2022 by default #78

Workflow file for this run

name: Backend - build and deploy
on:
push:
branches:
- main
paths:
- "server/**" # limit workflow only to changes in backend folder
- ".github/workflows/server-cd.yml"
pull_request:
branches:
- main
paths:
- "server/**"
- ".github/workflows/server-cd.yml"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout current repository
uses: actions/checkout@v3
- name: set up Java 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
- name: build application jar
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
arguments: build
build-root-directory: server
- name: create server artifact from jar
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: server
path: server/build
publish:
needs: build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: checkout current repository
uses: actions/checkout@v3
- name: download server artifact
uses: actions/download-artifact@v3
with:
name: server
path: server/build
- name: set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: build and publish server Docker image
uses: docker/build-push-action@v3
with:
context: server
file: server/docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: stenal/baltic-stock-server:latest
- name: deploy production docker-compose.yml
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
source: "server/docker/prod/docker-compose.yml"
target: "~"
strip_components: 3
- name: Deploy published images
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
docker compose pull
docker compose up -d