Skip to content

Merge PR #48: Roadmap buildout + Render deploy & security fixes #31

Merge PR #48: Roadmap buildout + Render deploy & security fixes

Merge PR #48: Roadmap buildout + Render deploy & security fixes #31

Workflow file for this run

name: Staging Validation

Check failure on line 1 in .github/workflows/staging.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/staging.yml

Invalid workflow file

(Line: 42, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.STAGING_DEPLOY_HOOK != ''
on:
workflow_run:
workflows: ["CI/CD Pipeline"]
branches: ["develop"]
types: [completed]
jobs:
staging-deploy:
name: Deploy to Staging
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push staging image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/spectracleanse-api:staging-${{ github.event.workflow_run.head_commit.sha }}
${{ secrets.DOCKERHUB_USERNAME }}/spectracleanse-api:staging-latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Trigger staging deployment
if: ${{ secrets.STAGING_DEPLOY_HOOK != '' }}
run: |
curl -sf -X POST "${{ secrets.STAGING_DEPLOY_HOOK }}" \
-H "Content-Type: application/json" \
-d '{
"image":"${{ secrets.DOCKERHUB_USERNAME }}/spectracleanse-api:staging-${{ github.event.workflow_run.head_commit.sha }}",
"environment":"staging"
}'
- name: Run smoke tests on staging
run: |
echo "Waiting for staging deployment..."
sleep 10
if [ ! -z "${{ secrets.STAGING_URL }}" ]; then
for i in $(seq 1 10); do
if curl -sf "${{ secrets.STAGING_URL }}/api/health"; then
echo "Staging health check passed"
exit 0
fi
sleep 5
done
echo "Staging failed to respond"
exit 1
fi