Skip to content

Merge pull request #230 from serguun42/bring-docker #143

Merge pull request #230 from serguun42/bring-docker

Merge pull request #230 from serguun42/bring-docker #143

Workflow file for this run

name: Build on push to master
on:
push:
branches:
- master
workflow_dispatch:
jobs:
configure:
name: Configure
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- name: Copy configs
env:
CONFIGS_LOCATION_BASE: ${{ secrets.CONFIGS_LOCATION_BASE }}
run: |
cp $CONFIGS_LOCATION_BASE/notifier-and-logger.config.json ./notifier/;
cp $CONFIGS_LOCATION_BASE/scrapper.config.json ./scrapper/;
cp $CONFIGS_LOCATION_BASE/backend.config.json ./backend/;
cp $CONFIGS_LOCATION_BASE/telegram-bot.config.json ./telegram/
[[ -f $CONFIGS_LOCATION_BASE/tag-manager.html ]] &&
cp $CONFIGS_LOCATION_BASE/tag-manager.html ./frontend/src/config/tag-manager.html ||
echo "" > ./frontend/src/config/tag-manager.html;
[[ -f $CONFIGS_LOCATION_BASE/apps-links.json ]] &&
cp $CONFIGS_LOCATION_BASE/apps-links.json ./frontend/src/config/apps-links.json ||
echo "[]" > ./frontend/src/config/apps-links.json;
[[ -d $CONFIGS_LOCATION_BASE/platforms/ ]] &&
cp -r $CONFIGS_LOCATION_BASE/platforms ./frontend/public/img/
build:
name: Docker Build
runs-on: self-hosted
needs: configure
steps:
- name: Build Docker images
env:
CONFIGS_LOCATION_BASE: ${{ secrets.CONFIGS_LOCATION_BASE }}
run: docker compose --env-file $CONFIGS_LOCATION_BASE/docker.env build --no-cache
deploy:
name: Docker Deploy
runs-on: self-hosted
needs: build
steps:
- name: Deploy Docker images
env:
CONFIGS_LOCATION_BASE: ${{ secrets.CONFIGS_LOCATION_BASE }}
run: docker compose --env-file $CONFIGS_LOCATION_BASE/docker.env up -d --force-recreate --no-deps
clean:
name: Clean cache and dangling images
runs-on: self-hosted
needs: deploy
steps:
- name: Clean dangling images
run: |
DANGLING_IMAGES=$(docker images -qf "dangling=true");
[[ ! -z "$DANGLING_IMAGES" ]] && docker rmi $DANGLING_IMAGES || echo "No dangling images"
notify:
name: Send final logs
runs-on: self-hosted
needs: deploy
steps:
- name: Send logs via notifier
env:
CONFIGS_LOCATION_BASE: ${{ secrets.CONFIGS_LOCATION_BASE }}
run: |
source $CONFIGS_LOCATION_BASE/docker.env;
curl http://127.0.0.1:$NOTIFIER_PUBLISH_PORT -d "{\"error\":false,\"args\":[\"Done merge into master, initiator – $GITHUB_ACTOR\"],\"tag\":\"ci\"}" ||
echo "Done merge into master, initiator – $GITHUB_ACTOR"