Skip to content

Add active boolean field to Pose model (#564) #115

Add active boolean field to Pose model (#564)

Add active boolean field to Pose model (#564) #115

Workflow file for this run

name: push
on:
push:
branches: main
tags:
- 'v*'
env:
BACKEND_IMAGE_NAME: alert-api
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_LOGIN }}
PYTHON_VERSION: "3.11"
POETRY_VERSION: "1.8.3"
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: abatilo/actions-poetry@v4
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Resolve dependencies
run: poetry export -f requirements.txt --without-hashes --output requirements.txt
- name: Resolve image tag
run: |
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
echo "IMAGE_TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
else
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
fi
- name: Build docker
run: docker build -f src/Dockerfile . -t $DOCKERHUB_USER/$BACKEND_IMAGE_NAME:$IMAGE_TAG
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_LOGIN }}
password: ${{ secrets.DOCKERHUB_PW }}
- name: Push to hub
run: docker push $DOCKERHUB_USER/$BACKEND_IMAGE_NAME:$IMAGE_TAG
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to container registry
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$BACKEND_IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
docker tag $DOCKERHUB_USER/$BACKEND_IMAGE_NAME:$IMAGE_TAG $IMAGE_ID:$IMAGE_TAG
docker push $IMAGE_ID:$IMAGE_TAG
deploy-dev:
if: github.ref == 'refs/heads/main'
needs: docker
runs-on: ubuntu-latest
steps:
- uses: appleboy/ssh-action@v1.2.2
with:
host: ${{ secrets.SSH_DEV_HOST }}
username: ${{ secrets.SSH_DEV_USERNAME }}
key: ${{ secrets.SSH_DEPLOY_DEV }}
script: |
# Ensure we have max disk space
docker rmi -f $(docker images -f "dangling=true" -q)
docker volume rm -f $(docker volume ls -f "dangling=true" -q)
# Update the service
docker compose pull backend
docker compose stop backend && docker compose up -d --wait
# Check update
docker inspect -f '{{ .Created }}' $(docker compose images -q backend)
# Clean up
docker rmi -f $(docker images -f "dangling=true" -q)
docker volume rm -f $(docker volume ls -f "dangling=true" -q)
- name: Ping server
env:
DEV_ENDPOINT: ${{ secrets.DEV_ENDPOINT }}
run: sleep 10 && curl $DEV_ENDPOINT