Skip to content

Reconcile AAA filing result on submission-id write (close #13 race) #47

Reconcile AAA filing result on submission-id write (close #13 race)

Reconcile AAA filing result on submission-id write (close #13 race) #47

Workflow file for this run

name: Deploy to Production
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
version:
description: 'Version to deploy (e.g. 0.9.3)'
required: true
concurrency:
group: deploy-prod
cancel-in-progress: false
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -e ".[dev]"
- name: Run tests
env:
USE_SSH_TUNNEL: "false"
DATABASE_URL: "sqlite:///:memory:"
run: python -m pytest tests/ -v --tb=short
build-and-deploy:
name: Build & Deploy to Production
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Extract version
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
else
echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
fi
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: deploy/docker/Dockerfile
push: true
build-args: |
APP_VERSION=${{ steps.version.outputs.version }}
GIT_COMMIT=${{ github.sha }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
- name: Deploy to production server
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.PROD_SSH_HOST }}
username: ec2-user
key: ${{ secrets.PROD_SSH_KEY }}
script: |
export IMAGE_TAG="${{ steps.version.outputs.version }}"
export GITHUB_REPOSITORY_OWNER="${{ github.repository_owner }}"
bash /home/ec2-user/api/deploy.sh
- name: Verify deployment
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.PROD_SSH_HOST }}
username: ec2-user
key: ${{ secrets.PROD_SSH_KEY }}
script: bash /home/ec2-user/api/health-check.sh http://localhost:8000