Skip to content

Commit

Permalink
fixed ci/cd for dev
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDyakonov committed Jan 22, 2025
1 parent bcbab31 commit e5142c0
Showing 1 changed file with 48 additions and 6 deletions.
54 changes: 48 additions & 6 deletions .github/workflows/cd-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: cd-dev

on:
push:
branches:
- dev
on: [workflow_dispatch]

jobs:
ci-tests:
Expand Down Expand Up @@ -46,8 +43,53 @@ jobs:
${{ secrets.DOCKER_USERNAME }}/dishdash-dashboard:dev
${{ secrets.DOCKER_USERNAME }}/dishdash-dashboard:dev-${{ env.COMMIT_SHORT_SHA }}
- name: Trigger Watchtower to update dev container
- name: Docker hub push notification
uses: containrrr/shoutrrr-action@v1
with:
url: telegram://${{ secrets.ALERTS_TELEGRAM_HTTP_API_TOKEN }}@telegram/?channels=${{ secrets.ALERTS_CHAT_ID }}
title: "Docker image sent: ${{ env.COMMIT_SHORT_SHA }}"
message: |
✅ Docker image for commit: ${{ github.sha }} has been successfully built and pushed to Docker Hub.
Branches/tags:: dev, ${{ env.COMMIT_SHORT_SHA }}.
Repository: ${{ github.repository }}
Commit url: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
Triggering portainer webhook...
- name: Trigger portainer webhook to update container
id: portainer_webhook
shell: bash
run: |
curl -H "Authorization: Bearer ${{ secrets.WATCHTOWER_HTTP_API_TOKEN }}" ${{ secrets.WATCHTOWER_UPDATE_ENDPOINT_DEV }}
response=$(curl -s -o /dev/null -w "%{http_code}" \
-X POST "${{ secrets.PORTAINER_WEBHOOK_URL }}/${{ secrets.SERVICE_HASH }}?tag=dev")
if [ "$response" -ne 204 ]; then
echo "Error: expected 204, but got $response"
exit 1
fi
- name: Shoutrrr - success
if: ${{ success() }}
uses: containrrr/shoutrrr-action@v1
with:
url: telegram://${{ secrets.ALERTS_TELEGRAM_HTTP_API_TOKEN }}@telegram/?channels=${{ secrets.ALERTS_CHAT_ID }}
title: "Deployment of ${{ env.COMMIT_SHORT_SHA }} has been successfully started"
message: |
✅ Container has been successfully updated via Portainer.
Commit: ${{ github.sha }}
Repository: ${{ github.repository }}
Link to commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
- name: Shoutrrr - fail
if: ${{ failure() }}
uses: containrrr/shoutrrr-action@v1
with:
url: telegram://${{ secrets.ALERTS_TELEGRAM_HTTP_API_TOKEN }}@telegram/?channels=${{ secrets.ALERTS_CHAT_ID }}
title: "Deployment failed"
message: |
❌ An error occurred during deployment for commit ${{ github.sha }}.
Repository: ${{ github.repository }}
Check the pipeline logs for details.

0 comments on commit e5142c0

Please sign in to comment.