Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 6 additions & 41 deletions .github/workflows/cdeploy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
name: CDeploy

# CDeploy workflow for deploying the latest successful CDelivery package to EC2
permissions:
actions: read
contents: read

# Manual deployment trigger
on:
workflow_dispatch:

Expand All @@ -26,40 +23,6 @@ jobs:
exit 1
fi

- name: Verify latest CDelivery succeeded
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const response = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'CDelivery.yml',
branch: 'main',
status: 'completed',
per_page: 1,
});

const runs = response.data.workflow_runs;

if (!runs || runs.length === 0) {
throw new Error(
'No completed CDelivery workflow runs found on main.'
);
}

const latest = runs[0];

if (latest.conclusion !== 'success') {
throw new Error(
`Latest CDelivery run failed:\n${latest.html_url}`
);
}

console.log(
`Latest CDelivery succeeded:\n${latest.html_url}`
);

- name: Deploy on EC2
env:
EC2_HOST: ${{ secrets.EC2_HOST }}
Expand Down Expand Up @@ -92,6 +55,8 @@ jobs:

set -e

mkdir -p ~/app/current

cd ~/app/releases

echo "Finding latest release..."
Expand All @@ -101,7 +66,7 @@ jobs:
echo "Latest release: $LATEST_RELEASE"

rm -rf ~/app/current/*

tar -xzf "$LATEST_RELEASE" -C ~/app/current

cd ~/app/current
Expand All @@ -115,15 +80,15 @@ jobs:

docker system prune -f

echo "Building new Docker image..."
echo "Building Docker image..."

docker build -t rag-api -f docker/Dockerfile .

echo "Starting new container..."
echo "Starting container..."

docker run -d \
--name rag-api \
-p 8000:8000 \
-p 127.0.0.1:8000:8000 \
-v ~/app/shared/datasets:/datasets \
-v ~/logs:/logs \
rag-api
Expand Down
Loading