Updated Java JDK from 11 to 17 used in backend app (#2597) #670
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Build, Push images and redeploy instances | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build_and_publish_backend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Publish to Registry brainup/brn-backend | |
uses: elgohr/Publish-Docker-Github-Action@master | |
with: | |
name: brainup/brn-backend | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
build_and_publish_frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Publish to Registry brainup/brn-frontend | |
uses: elgohr/Publish-Docker-Github-Action@master | |
with: | |
name: brainup/brn-frontend | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
dockerfile: Dockerfile_frontend | |
build_and_publish_frontend_with_tls: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Publish to Registry brainup/brn-frontend-with-tls | |
uses: elgohr/Publish-Docker-Github-Action@master | |
with: | |
name: brainup/brn-frontend-with-tls | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
dockerfile: Dockerfile_frontend_with_tls | |
redeploy_instance: | |
needs: [ build_and_publish_backend, build_and_publish_frontend, build_and_publish_frontend_with_tls] | |
runs-on: ${{ matrix.runners }} | |
strategy: | |
matrix: | |
# runners: [ epam, vscale ] | |
runners: [ vscale ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configure secrets | |
run: | | |
echo "$S3_KEY"|base64 -d > aws-key.properties | |
echo "$FIREBASE_CONFIG"|base64 -d > firebase_config.json | |
mv docker-compose-run.yml docker-compose.yml | |
sed -i -e "s/_YANDEX_AUTH_TOKEN_/\\$YANDEX_AUTH_TOKEN/" docker-compose.yml | |
sed -i -e "s/_YANDEX_FOLDER_ID_/\\$YANDEX_FOLDER_ID/" docker-compose.yml | |
sed -i -e "s/_POSTGRES_PASSWORD_/\\$POSTGRES_PASSWORD/" docker-compose.yml | |
sed -i -e "s/_API_GITHUB_TOKEN_/\\$API_GITHUB_TOKEN/" docker-compose.yml | |
env: | |
S3_KEY: ${{ secrets.S3_KEY }} | |
FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }} | |
YANDEX_AUTH_TOKEN: ${{ secrets.YANDEX_AUTH_TOKEN }} | |
YANDEX_FOLDER_ID: ${{ secrets.YANDEX_FOLDER_ID }} | |
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
API_GITHUB_TOKEN: ${{ secrets.API_GITHUB_TOKEN }} | |
# It is unclear how to use IF, so option from the first link is used. In case of crash we can rewrite to if: ${{matrix.runners == 'vscale'}} | |
# Link 1: https://github.community/t/what-is-the-correct-if-condition-syntax-for-checking-matrix-os-version/16221 | |
# Link 2: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsif | |
- name: Redeploy backend | |
run: | | |
docker-compose pull | |
docker-compose up -d --no-deps brn | |
- name: Redeploy frontend epam | |
if: matrix.runners == 'epam' | |
run: docker-compose up -d --no-deps brn_fe | |
- name: Redeploy frontend vscale | |
if: matrix.runners == 'vscale' | |
run: docker-compose up -d --no-deps brn_fe_with_tls | |
- name: Remove old images | |
run: docker image prune -af |