fix cicd
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m2s

This commit is contained in:
Warunee Tamkoo 2025-09-16 11:33:11 +07:00
parent 9a4f5b5d27
commit e9207c90fa
3 changed files with 16 additions and 54 deletions

View file

@ -48,23 +48,3 @@ jobs:
file: ./docker/Dockerfile
tags: ${{ env.CONTAINER_IMAGE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
push: true
- name: Discord Notification
if: always()
run: |
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"embeds": [{
"title": $STATUS,
"description": "**Build:**\n- Image: `${{env.CONTAINER_IMAGE_NAME}}`\n- Version: `${{ env.IMAGE_VERSION }}`\n- Deployed by: `${{gitea.actor}}`",
"color": $COLOR,
"footer": {
"text": "Release Notification",
"icon_url": "https://example.com/success-icon.png"
},
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}]
}' \
${{ env.DISCORD_WEBHOOK }}

View file

@ -1,5 +1,5 @@
# /.forgejo/workflows/build.yml
name: Build & Deploy
# /.forgejo/workflows/ci-cd.yml
name: Build & Deploy on Dev
on:
push:
@ -12,7 +12,7 @@ env:
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}/${{ vars.CONTAINER_IMAGE_NAME }}
IMAGE_VERSION: build
IMAGE_VERSION: latest
DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }}
jobs:
@ -29,7 +29,7 @@ jobs:
ca=["/etc/ssl/certs/ca-certificates.crt"]
- name: Tag Version
run: |
echo "IMAGE_VERSION=latest" >> $GITHUB_ENV
echo "IMAGE_VERSION=latest"
- name: Login in to registry
uses: docker/login-action@v2
with:
@ -55,23 +55,25 @@ jobs:
cd ~/repo
./replace-env.sh APP_USER "${{ env.IMAGE_VERSION }}"
./deploy.sh hrms-user
- name: Discord Notification
if: always()
run: |
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"embeds": [{
"title": $STATUS,
"description": "**Build & Deploy:**\n- Image: `${{env.CONTAINER_IMAGE_NAME}}`\n- Version: `${{ env.IMAGE_VERSION }}`\n- Deployed by: `${{gitea.actor}}`",
"color": $COLOR,
"footer": {
"text": "Release Notification",
"icon_url": "https://example.com/success-icon.png"
-d "{
\"embeds\": [{
\"title\": \"$STATUS\",
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ github.actor }}\`\",
\"color\": $COLOR,
\"footer\": {
\"text\": \"Release Notification\",
\"icon_url\": \"https://example.com/success-icon.png\"
},
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
\"timestamp\": \"$TIMESTAMP\"
}]
}' \
}" \
${{ env.DISCORD_WEBHOOK }}

View file

@ -27,23 +27,3 @@ jobs:
cd ~/repo
./replace-env.sh APP_USER "${{ inputs.version }}"
./deploy.sh hrms-user
- name: Discord Notification
if: always()
run: |
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"embeds": [{
"title": $STATUS,
"description": "**Deploy APP_USER**\n- Version: `${{ env.IMAGE_VERSION }}`\n- Deployed by: `${{gitea.actor}}`",
"color": $COLOR,
"footer": {
"text": "Release Notification",
"icon_url": "https://example.com/success-icon.png"
},
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}]
}' \
${{ env.DISCORD_WEBHOOK }}