Add 'on hold' note #46
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: Build and Push Docker Images, Deploy Them on The Server | |
on: | |
push: | |
branches: | |
- master | |
permissions: | |
contents: read | |
packages: write | |
env: | |
GITHUB_ACTOR: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push bot Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./services/bot/Dockerfile | |
push: true | |
tags: ghcr.io/${{ github.repository }}/bot:latest | |
- name: Build and Push feed_poller Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./services/feed_poller/Dockerfile | |
push: true | |
tags: ghcr.io/${{ github.repository }}/feed_poller:latest | |
- name: Pull Images and Deploy Them on The Server | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
port: ${{ secrets.SSH_PORT }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
cd ${{ secrets.SSH_WORKDIR }} | |
git pull | |
# create secrets: | |
mkdir -p .secrets | |
echo "${{ secrets.BOT_TOKEN }}" > .secrets/telegram_bot_token | |
echo "${{ secrets.MONGO_DATABASE }}" > .secrets/mongo_database | |
# put telegram secrets to .env fiile (temporary solution until secrets are not supported by aiogram/telegram-bot-api) | |
mkdir -p ./services/telegram-bot-api | |
echo > ./services/telegram-bot-api/.env | |
echo "TELEGRAM_API_HASH=${{ secrets.TELEGRAM_API_HASH }}" >> ./services/telegram-bot-api/.env | |
echo "TELEGRAM_API_ID=${{ secrets.TELEGRAM_API_ID }}" >> ./services/telegram-bot-api/.env | |
# login to images registery: | |
echo "${{ env.GITHUB_TOKEN }}" | docker login --password-stdin --username "${{ env.GITHUB_ACTOR }}" ghcr.io | |
# deploy | |
docker compose -f ./docker-compose.prod.yml up --pull=always --detach |