Skip to content

fix: better handling of redirect back after installing app (#38) #29

fix: better handling of redirect back after installing app (#38)

fix: better handling of redirect back after installing app (#38) #29

Workflow file for this run

name: Build and push backend image
on:
push:
branches: [main]
paths:
- backend/**
- .github/workflows/build-backend.yml
jobs:
build-and-push-backend:
environment: production-api
defaults:
run:
working-directory: backend
env:
IMAGE_NAME: incidental/backend
ECR_REPO: registry.digitalocean.com/incidental
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Create version file
run: |
git rev-parse --short HEAD > .version
- name: Build image
uses: docker/build-push-action@v5
with:
context: backend
tags: ${{env.IMAGE_NAME}}:latest,${{env.ECR_REPO}}/${{env.IMAGE_NAME}}:latest,${{env.ECR_REPO}}/${{env.IMAGE_NAME}}:1.0.${{ github.run_number }}
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=docker
- name: Copy env file
run: cp .env.example .env
- name: Create the docker compose stack
run: docker compose -f docker-compose.yml up -d
- name: Check local running docker contains
run: docker ps -a
- name: Migrate db
run: docker compose -f docker-compose.yml exec -T backend sh -c "alembic upgrade head"
- name: Runs tests
run: docker compose -f docker-compose.yml exec -T backend sh -c "pytest"
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Push image
run: |
doctl registry login --expiry-seconds 300
docker push ${ECR_REPO}/${IMAGE_NAME}:latest
docker push ${ECR_REPO}/${IMAGE_NAME}:1.0.${GITHUB_RUN_NUMBER}
- name: Slack Notification
uses: slackapi/[email protected]
with:
payload: |
{
"text": "A new backend has been pushed: 1.0.${{ github.run_number }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}