Skip to content

Commit

Permalink
Updated ci/cd pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDyakonov committed Jan 24, 2025
1 parent 6d761b3 commit d89b9e6
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 12 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/cd-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
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 }}"
title: "[DEV] 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 }}.
Expand All @@ -62,7 +62,7 @@ jobs:
shell: bash
run: |
response=$(curl -s -o /dev/null -w "%{http_code}" \
-X POST "${{ secrets.PORTAINER_WEBHOOK_URL }}/${{ secrets.SERVICE_HASH }}?tag=dev")
-X POST "${{ secrets.PORTAINER_WEBHOOK_URL }}/${{ secrets.SERVICE_HASH_DEV }}?tag=dev")
if [ "$response" -ne 204 ]; then
echo "Error: expected 204, but got $response"
Expand All @@ -74,9 +74,9 @@ jobs:
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"
title: "[DEV] Deployment of ${{ env.COMMIT_SHORT_SHA }} has been successfully started"
message: |
✅ Container has been successfully updated via Portainer.
✅ Container has been successfully updated via Portainer.
Commit: ${{ github.sha }}
Repository: ${{ github.repository }}
Expand All @@ -87,9 +87,9 @@ jobs:
uses: containrrr/shoutrrr-action@v1
with:
url: telegram://${{ secrets.ALERTS_TELEGRAM_HTTP_API_TOKEN }}@telegram/?channels=${{ secrets.ALERTS_CHAT_ID }}
title: "Deployment failed"
title: "[DEV] Deployment failed"
message: |
❌ An error occurred during deployment for commit ${{ github.sha }}.
Repository: ${{ github.repository }}
Check the pipeline logs for details.
Check the pipeline logs for details.
56 changes: 50 additions & 6 deletions .github/workflows/cd-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ name: cd-prod

on:
workflow_dispatch:
inputs:
tag_name:
description: Write tag for deploy
required: true
release:
types: [released]

jobs:
ci-tests:
Expand Down Expand Up @@ -43,7 +41,53 @@ jobs:
${{ secrets.DOCKER_USERNAME }}/dishdash-dashboard:latest
${{ secrets.DOCKER_USERNAME }}/dishdash-dashboard:${{ github.event.inputs.tag_name }}
- name: Trigger watchtower to update container(s)
- 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: "[PROD] 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: latest, ${{ env.VERSION_TAG }}.
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 }}
response=$(curl -s -o /dev/null -w "%{http_code}" \
-X POST "${{ secrets.PORTAINER_WEBHOOK_URL }}/${{ secrets.SERVICE_HASH }}?tag=latest")
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: "[PROD] 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: "[PROD] 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 d89b9e6

Please sign in to comment.