Skip to content

v1.3.1

v1.3.1 #30

Workflow file for this run

on:
workflow_dispatch:
release:
types: [ published ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- target: parser
image: mitso/parser
- target: keeper
image: mitso/keeper
- target: bot
image: mitso/bot
name: Build and push ${{ matrix.image }} image
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to container registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./${{ matrix.target }}
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: ${{ secrets.REGISTRY }}/${{ matrix.image }}:${{ github.ref_name }},${{ secrets.REGISTRY }}/${{ matrix.image }}:latest
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Install cloudflared
run: |
wget -q https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared-linux-amd64.deb
- name: Connect to server
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
known_hosts: unnecessary
name: id_rsa
config: |
Host ${{ secrets.DEPLOY_HOST }}
User ${{ secrets.DEPLOY_USERNAME }}
IdentityFile ~/.ssh/id_rsa
StrictHostKeyChecking=no
ProxyCommand cloudflared access ssh --hostname %h --id ${{ secrets.DEPLOY_AUTH_ID }} --secret ${{ secrets.DEPLOY_AUTH_SECRET }}
- name: Deploy
run: |
ssh ${{ secrets.DEPLOY_USERNAME }}@${{ secrets.DEPLOY_HOST }} "echo ${{ secrets.REGISTRY_PASSWORD }} | docker login --username ${{ secrets.REGISTRY_USERNAME }} --password-stdin ${{ secrets.REGISTRY }} && cd ${{ secrets.PROJECT_DIR }} && git pull && docker compose -f ./docker-compose.prod.yml pull --parallel --quiet && docker compose -f ./docker-compose.prod.yml up -d --remove-orphans && exit"