49 lines
1.5 KiB
YAML
49 lines
1.5 KiB
YAML
name: Build
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Version to deploy"
|
|
type: string
|
|
required: false
|
|
default: "latest"
|
|
|
|
env:
|
|
IMAGE_VERSION: build
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Remote Deploy
|
|
uses: appleboy/ssh-action@v1.2.1
|
|
with:
|
|
host: ${{ vars.SSH_DEPLOY_HOST }}
|
|
port: ${{ vars.SSH_DEPLOY_PORT }}
|
|
username: ${{ secrets.SSH_DEPLOY_USER }}
|
|
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
|
script: |
|
|
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 }}
|