Files
website/.gitea/workflows/deploy.yaml
Akshay Kolli 5949fb6808
All checks were successful
Deploy Website / build-and-deploy (push) Successful in 21s
Fix Nginx startup in deployment
2026-07-18 20:11:06 -04:00

50 lines
1.4 KiB
YAML

name: Deploy Website
on:
push:
branches:
- main
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Build Docker image
run: |
docker build --pull -t akkolli-website:latest .
- name: Validate web server configuration
run: |
docker run --rm akkolli-website:latest nginx -t
- name: Stop existing container
run: |
docker stop website-container || true
docker rm website-container || true
- name: Run new container
run: |
docker run -d \
--name website-container \
--restart unless-stopped \
-p 8083:80 \
akkolli-website:latest
- name: Purge Cloudflare cache
env:
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
run: |
if [ -n "$CLOUDFLARE_ZONE_ID" ] && [ -n "$CLOUDFLARE_API_TOKEN" ]; then
curl --fail --silent --show-error \
--request POST \
--url "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/purge_cache" \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{"purge_everything":true}'
fi