Compare commits
2 Commits
7d7470f01d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f077cec119 | ||
|
|
08da066855 |
@@ -3,40 +3,32 @@ name: Build & push Docker image
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*' # Trigger on push to all branches
|
||||
- '*'
|
||||
|
||||
env:
|
||||
IMAGE_NAME: "contact-api" # e.g wavyzz/hello-world
|
||||
DOCKERFILE: "./Dockerfile"
|
||||
REGISTRY_HOST: ${{ secrets.REGISTRY_HOST }}
|
||||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
IMAGE_NAME: "contact-api"
|
||||
CONTEXT_PATH: "."
|
||||
DOCKERFILE_PATH: "./Dockerfile"
|
||||
PLATFORMS: "linux/amd64"
|
||||
CACHE_REF: ${{ env.REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:buildcache
|
||||
GITEA_TOKEN: ${{ secrets.CI_GITEA_TOKEN }}
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://github.com/actions/checkout@v5
|
||||
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
|
||||
id: extract_branch
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: https://github.com/docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to private registry
|
||||
uses: docker/login-action@v3
|
||||
- name: Build & push Docker image
|
||||
uses: estebanthi/ci/actions/docker-build-push@master
|
||||
with:
|
||||
registry: https://${{ secrets.DOCKER_REGISTRY_HOST }}
|
||||
username: ${{ secrets.DOCKER_REGISTRY_USER }}
|
||||
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: https://github.com/docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: "${{ env.DOCKERFILE }}"
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKER_REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }}
|
||||
${{ secrets.DOCKER_REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:latest
|
||||
registry: ${{ env.REGISTRY_HOST }}
|
||||
username: ${{ env.REGISTRY_USERNAME }}
|
||||
password: ${{ env.REGISTRY_PASSWORD }}
|
||||
image_name: ${{ env.IMAGE_NAME }}
|
||||
context_path: ${{ env.CONTEXT_PATH }}
|
||||
dockerfile_path: ${{ env.DOCKERFILE_PATH }}
|
||||
platforms: ${{ env.PLATFORMS }}
|
||||
cache_ref: ${{ env.CACHE_REF }}
|
||||
github_token: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
@@ -122,9 +122,8 @@ async def contact(req: Request, data: ContactIn):
|
||||
error_messages.append(f"webhook: {e}")
|
||||
|
||||
if not delivered:
|
||||
# Fallback to log-only; still return OK to avoid leaking signals to bots
|
||||
print("[WARN] Contact not delivered", {"errors": error_messages})
|
||||
return ContactOut(ok=True, message="Thanks! I’ll reply soon.")
|
||||
return ContactOut(ok=False, message="Sorry, something went wrong. Please try again later.")
|
||||
|
||||
return ContactOut(ok=True, message="Thanks! I’ll reply soon.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user