Skip to content

Reader 18

Reader 18 #20

Workflow file for this run

name: deploy
on:
pull_request:
branches: [ main, dev ]
jobs:
build-and-push:
name: Deploy images on the destination server
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'}}
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
registry: registry.andyi95.com
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Set APP_VERSION
run: echo "APP_VERSION=$(echo ${GITHUB_SHA::8})" >> $GITHUB_ENV
- name: Build and push frontend
uses: docker/build-push-action@v2
with:
context: frontend
file: frontend/stage.Dockerfile
push: true
tags: registry.andyi95.com/text-tools/reading-frontend:${{ env.APP_VERSION }}
- name: Build and push backend
uses: docker/build-push-action@v2
with:
context: backend
file: backend/Dockerfile
push: true
tags: registry.andyi95.com/text-tools/reading-backend:${{ env.APP_VERSION }}
- name: Test start configuration
env:
COMPOSE_FILE: docker-compose.yaml:docker-compose.override.yaml:docker-compose.stage.yaml
run: |
docker-compose up -d
docker-compose ps
sleep 10
if [ $(docker-compose ps -q | wc -l) -ne $(docker-compose config --services | wc -l) ]; then
echo "Not all containers are running."
docker-compose ps
exit 1
fi
docker-compose down
send-telegram-message:
name: send-telegram-message
runs-on: ubuntu-latest
steps:
- name: send telegram message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
Report on the last run of ${{ github.workflow }}.
${{ github.job }} in workflow ${{ github.action }} from repo ${{ github.repository }} has finished with status ${{ job.status }}.