Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
659 commits
Select commit Hold shift + click to select a range
8576491
fix format (#407)
gohumble Aug 31, 2022
51ac159
remove href
callebtc Aug 31, 2022
5c950ef
Merge pull request #408 from LightningTipBot/webapp_remove_href
callebtc Aug 31, 2022
d3c2fe7
disable dalle if key is empty (#409)
gohumble Aug 31, 2022
94ed7d4
dalle admin api. Added configurable worker (#410)
gohumble Aug 31, 2022
ced9446
update error handling and logs (#411)
gohumble Aug 31, 2022
b9bf071
button fix
callebtc Aug 31, 2022
e8f24d9
Merge pull request #412 from LightningTipBot/buttonfix123
callebtc Aug 31, 2022
1f5a6a5
krass
callebtc Aug 31, 2022
d5ff486
Merge pull request #413 from LightningTipBot/dalle_logging_update
callebtc Aug 31, 2022
c561ae2
updated golnurl (#414)
gohumble Sep 7, 2022
45931c0
decode lnurl using strict functions (#415)
gohumble Sep 7, 2022
32a5863
fix api lookup
callebtc Sep 17, 2022
62d7dd9
Merge pull request #418 from LightningTipBot/fix/api_user_lookup
callebtc Sep 17, 2022
7a2aba5
add polish (#417)
jesterhodl Sep 25, 2022
9e8958e
Update pl.toml (#419)
gohumble Sep 25, 2022
ec679d5
removed connection keep alive header (#421)
gohumble Oct 6, 2022
64055db
sse fix (#422)
gohumble Oct 6, 2022
bc8c8f9
trim whitespaces in send handler (#424)
gohumble Oct 20, 2022
ed5ceeb
typo in example config (#426)
ChuckNorrison Oct 27, 2022
895fd06
added GetClientForScheme (#429)
gohumble Nov 3, 2022
a67ec62
added isOnionRegex (#430)
gohumble Nov 3, 2022
01f4cff
Translation cz (#425)
sifrant Nov 3, 2022
c611969
moved translation (#431)
gohumble Nov 3, 2022
d264650
#432 return default http client for empty socks host configuration (#…
gohumble Nov 28, 2022
8b32e5f
fix: fr translation lnurl message
callebtc Dec 8, 2022
74e9f7a
Merge pull request #434 from LightningTipBot/translation/fr/fix_lnurl
callebtc Dec 8, 2022
8598adb
added chatGPT (#435)
gohumble Dec 11, 2022
b50270f
remove limit
callebtc Dec 25, 2022
3112b79
Merge pull request #437 from LightningTipBot/shop/remove_limit
callebtc Dec 25, 2022
2f61a96
add successaction
callebtc Jan 14, 2023
73d87fc
Merge pull request #439 from LightningTipBot/lnurl/successAction
callebtc Jan 14, 2023
120d7c4
no preview for urls
callebtc Jan 14, 2023
b0e43f1
Merge pull request #440 from LightningTipBot:fix/lnurlp/successaction…
callebtc Jan 14, 2023
2c76764
nil check for successaction context
callebtc Jan 14, 2023
c47038f
Merge pull request #441 from LightningTipBot/fix/nil_successaction
callebtc Jan 14, 2023
1a21a15
add memo to lnurl command
callebtc Jan 14, 2023
998967c
Merge pull request #442 from LightningTipBot/lnurl/advanced_help
callebtc Jan 14, 2023
0582780
remove send button until fixed
callebtc Jan 16, 2023
9e64dbb
Merge pull request #444 from LightningTipBot/fix/remove_send_button_temp
callebtc Jan 16, 2023
0efc5c4
disable gpt and remove from help
callebtc Jan 16, 2023
84fe1d7
Merge pull request #445 from LightningTipBot/disable_gpt
callebtc Jan 16, 2023
7204d85
kick ticket initial commit
gohumble Jan 19, 2023
ab00715
reset
gohumble Jan 19, 2023
7eaef10
rename
gohumble Jan 19, 2023
9271668
cleanup
gohumble Jan 19, 2023
ab5da78
commission
gohumble Jan 19, 2023
56318b3
fixes
callebtc Jan 20, 2023
0225a59
added tryLoadUserInterceptor
gohumble Jan 20, 2023
9722699
fix webhook
gohumble Jan 20, 2023
3ea9ef0
fix text
gohumble Jan 20, 2023
b3bbe61
fix strings
callebtc Jan 22, 2023
6d0bc87
Merge pull request #446 from LightningTipBot/kick
callebtc Jan 22, 2023
51f2812
group help
callebtc Jan 22, 2023
681bf39
Merge pull request #447 from LightningTipBot/fix/group_help
callebtc Jan 22, 2023
8dabb38
fix: memo in api
callebtc Feb 6, 2023
01a8e3b
Merge pull request #449 from LightningTipBot/fix/api_memo
callebtc Feb 6, 2023
4318b48
nip57 zaps
callebtc Feb 16, 2023
a157521
Merge pull request #451 from LightningTipBot/zaps
callebtc Feb 16, 2023
7ab3d46
add files
callebtc Feb 16, 2023
c8ef698
Merge pull request #452 from LightningTipBot/nostr/add_files
callebtc Feb 16, 2023
40e7fca
fix nostr parser
callebtc Feb 16, 2023
b9cddbe
Merge pull request #453 from LightningTipBot/nostr/nip57-fix-parser
callebtc Feb 16, 2023
1a2776a
log nostr event id
callebtc Feb 16, 2023
603dbaa
Merge pull request #454 from LightningTipBot/nostr/logging
callebtc Feb 16, 2023
a712f52
moar relays
callebtc Feb 16, 2023
63cbd57
Merge pull request #455 from LightningTipBot/nostr/moar_relays
callebtc Feb 16, 2023
3a67719
nostr: optional e
callebtc Feb 16, 2023
4c3cb07
Merge pull request #456 from LightningTipBot/nostr/e_tag_optional
callebtc Feb 16, 2023
bdaf46c
clean url and wait for connect
callebtc Feb 16, 2023
cc4cb1c
Merge pull request #457 from LightningTipBot/nostr/relay_time
callebtc Feb 16, 2023
e7d1f9e
add nip05 (#458)
callebtc Feb 16, 2023
91cbf83
add files
callebtc Feb 16, 2023
7f0c635
Merge pull request #459 from LightningTipBot/nostr/nip05_add_files
callebtc Feb 16, 2023
ed17953
nostr: add bot pubkey to LNURLFirst not users
callebtc Feb 17, 2023
4769764
Merge pull request #461 from LightningTipBot/nostr/fix_nip057_pubkey
callebtc Feb 17, 2023
ba256a1
nostr logging and new relays (#462)
callebtc Feb 18, 2023
4fb4f54
Nostr/brrrr (#463)
callebtc Feb 18, 2023
1090b38
zaps: remove necessity to add pubkey (#465)
callebtc Feb 21, 2023
b4310b0
added massmux full install guide (#467)
massmux Feb 23, 2023
722c9c3
add /zap command for /tip (#468)
callebtc Feb 23, 2023
aeb0c4a
Create fi.toml Translate-Finnish (#469)
tlindi Feb 24, 2023
a65bf8d
nostr: respond on empty command for new users (#473)
callebtc Feb 28, 2023
6e6fb5d
feedback (#474)
callebtc Feb 28, 2023
84951d5
max relays (#476)
callebtc Mar 25, 2023
8e9c03d
update CommentAllowed and donate
gohumble Jun 29, 2023
6a9c5f4
fix amount (#478)
gohumble Jun 29, 2023
3077802
add logs (#479)
gohumble Jun 29, 2023
9919544
add amountsMap (#483)
callebtc Aug 13, 2023
c4f6d31
Fix in config example file (#472)
massmux Aug 13, 2023
d88b04a
update inputmode to decimal (ios keyboard) (#416)
gohumble Aug 13, 2023
532dbfe
show error on wrong send message (#487)
callebtc Nov 1, 2023
432da6d
disable preview in lnurl comments (#488)
callebtc Nov 14, 2023
7ba5951
lnurlp: filter links for small payments (#490)
callebtc Nov 16, 2023
8b2fb73
allow lnurlp comments only for 21 sats or more (#491)
callebtc Nov 16, 2023
0be3d26
do not store lnurl comments below amount threshold (#493)
callebtc Nov 23, 2023
5adf090
Display fiat currency (#496)
callebtc Dec 5, 2023
7c55e40
Add setting file (#497)
callebtc Dec 5, 2023
ce8882f
new update
xbuddhi Aug 28, 2024
7f65839
🤝 Community
xbuddhi Aug 28, 2024
a749a36
BitcoinDeepa Community
xbuddhi Aug 28, 2024
c51a14c
Update Telegram community link
xbuddhi Aug 31, 2024
ead3e61
Update Telegram community link
xbuddhi Aug 31, 2024
3f7163d
feat: Add new commands for transactions, linking wallet, Nostr connec…
xbuddhi Aug 31, 2024
00ddac0
docs: Update `README.md` (#6)
rasmr Sep 10, 2024
a3f1833
Add usd and lkr fiat value for balance with cache
helloscoopa Sep 17, 2024
a1c6efc
Use full precision for cache
helloscoopa Sep 17, 2024
55ee3c6
Fix typo
helloscoopa Sep 18, 2024
28d4788
Merge pull request #7 from CeyLabs/scoopa/show-balance-in-usd-lkr
xbuddhi Sep 24, 2024
b1febf5
feat: Implement error logging to Telegram for various operations
xbuddhi Jun 26, 2025
df3f51a
Merge pull request #9 from CeyLabs/dev
xbuddhi Jun 26, 2025
3090525
fix: Update error logging and webhook URL handling in group payment p…
xbuddhi Jun 26, 2025
e7110a7
Merge pull request #10 from CeyLabs/dev
xbuddhi Jun 26, 2025
765f4a0
feat: Add public webhook URL configuration and update webhook handlin…
xbuddhi Jun 26, 2025
1e4be3e
Merge pull request #11 from CeyLabs/dev
xbuddhi Jun 26, 2025
14d31a9
feat: Enhance error logging across Telegram bot operations with detai…
xbuddhi Jun 26, 2025
1a504e4
Merge pull request #12 from CeyLabs/dev
xbuddhi Jun 26, 2025
a2ecbcb
feat: Improve error message formatting in Telegram logger for better …
xbuddhi Jun 26, 2025
bf16b8b
Merge pull request #13 from CeyLabs/dev
xbuddhi Jun 26, 2025
16ec80b
feat: Update error logging format to use MarkdownV2 for improved read…
xbuddhi Jun 26, 2025
1213196
Merge pull request #14 from CeyLabs/dev
xbuddhi Jun 26, 2025
7112a96
feat: Refactor error message formatting in LogCriticalError for impro…
xbuddhi Jun 26, 2025
93c6381
Merge pull request #15 from CeyLabs/dev
xbuddhi Jun 26, 2025
eb67e9d
Implement admin approval workflow for large transactions
xbuddhi Jun 27, 2025
224cce9
Merge pull request #16 from CeyLabs/dev
xbuddhi Jun 27, 2025
644d142
feat: Enhance internal network validation and logging in API send con…
xbuddhi Jun 27, 2025
b5d50be
feat: Implement admin approval and rejection workflow for pending tra…
xbuddhi Jun 27, 2025
54c9fe5
Improve payment error log format
cmnisal Jun 27, 2025
4a81fff
feat: Implement API transaction approval workflow with Telegram integ…
xbuddhi Jun 27, 2025
e57e666
Merge pull request #19 from CeyLabs/dev
xbuddhi Jun 27, 2025
4fdc12e
feat: Enable API send configuration and add admin approval threshold …
xbuddhi Jun 27, 2025
18b02bd
Merge pull request #20 from CeyLabs/dev
xbuddhi Jun 27, 2025
820fd72
Add number formatting helper and apply to messages (#17)
ceyvibes Jun 27, 2025
ed971fb
Merge pull request #18 from CeyLabs/codex/fix-error-logging-format
xbuddhi Jun 27, 2025
96c084b
Add LKR to satoshi conversion command
cmnisal Jun 28, 2025
011449b
fix: Update logging and error messages to consistently use "sat(s)" f…
xbuddhi Jun 28, 2025
3a73cf9
feat: Add error logging configuration with filtering options for Tele…
xbuddhi Jun 30, 2025
6f11689
feat: Add GitHub Actions workflows for development and production dep…
xbuddhi Jul 6, 2025
164634a
feat: add lkr amounts everywhere (#24)
helloscoopa Jul 6, 2025
21fa764
Merge branch 'main' into dev
xbuddhi Jul 7, 2025
6ad5fb6
Merge pull request #23 from CeyLabs/dev
xbuddhi Jul 7, 2025
88de231
Apply suggestions from code review
xbuddhi Jul 7, 2025
da85488
Apply suggestions from code review
xbuddhi Jul 7, 2025
60e2533
Merge branch 'main' into cmnisal/add-lkr-to-sats-conversion-logic
xbuddhi Jul 7, 2025
288f307
Merge pull request #22 from CeyLabs/cmnisal/add-lkr-to-sats-conversio…
xbuddhi Jul 7, 2025
26afcc0
feat: Add GitHub Actions workflow for production deployment of Bitcoi…
xbuddhi Jul 7, 2025
6fb34b3
Merge branch 'main' of https://github.com/CeyLabs/BitcoinDeepaBot
xbuddhi Jul 7, 2025
221144f
refactor: Clean up formatting and spacing in coingecko.go
xbuddhi Jul 7, 2025
368bec8
refactor: Remove Go installation and configuration steps from deploym…
xbuddhi Jul 7, 2025
6c01f63
fix: Update deployment paths and project directory in GitHub Actions …
xbuddhi Jul 7, 2025
873305f
refactor: Improve Git existence check and output handling in deployme…
xbuddhi Jul 8, 2025
d50f483
Merge pull request #25 from CeyLabs/main
xbuddhi Jul 9, 2025
fd714e8
Add /convert command for sats to fiat
ceyvibes Jul 11, 2025
eabbfa5
feat: Implement HMAC authentication for payment API and add HMAC clie…
xbuddhi Jul 11, 2025
aadcbd1
Merge pull request #27 from CeyLabs/dev
xbuddhi Jul 11, 2025
d999ec2
fix: Update source path in deployment workflow to include all files
xbuddhi Jul 12, 2025
2ca8eaa
Merge pull request #28 from CeyLabs/dev
xbuddhi Jul 12, 2025
68ce46e
refactor: Update file transfer settings in deployment workflow for im…
xbuddhi Jul 12, 2025
6e90e00
Merge branch 'main' of https://github.com/CeyLabs/BitcoinDeepaBot
xbuddhi Jul 12, 2025
5033b08
fix: Update file source patterns in deployment workflow to include hi…
xbuddhi Jul 12, 2025
678a738
Merge pull request #29 from CeyLabs/dev
xbuddhi Jul 12, 2025
fa6d677
feat: Implement HMAC security for API send endpoint and add configura…
xbuddhi Jul 12, 2025
9604d75
Merge branch 'main' of https://github.com/CeyLabs/BitcoinDeepaBot
xbuddhi Jul 12, 2025
4fd6309
fix: Remove conditional check for Git existence before copying files …
xbuddhi Jul 12, 2025
4a205e8
fix: Update file copy step to use simplified source pattern and add s…
xbuddhi Jul 12, 2025
82f7935
fix: Add safe.directory configuration for Git in deployment script
xbuddhi Jul 12, 2025
d4fb33d
fix: Update Git remote URL to public HTTPS in deployment script
xbuddhi Jul 12, 2025
7041684
fix: Move application build step to server and remove local setup steps
xbuddhi Jul 12, 2025
61b6f10
fix: Remove unnecessary Git configuration steps for public repository…
xbuddhi Jul 12, 2025
729ec7b
Merge pull request #26 from CeyLabs/ceyvibes/add-convert-command-for-…
xbuddhi Jul 12, 2025
b5abde7
feat: Add payment API script for processing transactions
xbuddhi Jul 12, 2025
671808e
fix: Inline messages and balance display (#30)
ceyvibes Jul 13, 2025
cbdeb5d
feat: Add thousands separator to sat amounts (#31)
ceyvibes Jul 13, 2025
bf83842
fix: Add sat formatting to missed templates (#32)
helloscoopa Jul 13, 2025
7dab2b1
fix: overlooked repeating sat texts
helloscoopa Jul 13, 2025
0c4161c
Merge pull request #34 from CeyLabs/main
xbuddhi Jul 14, 2025
3ad10a3
feat: Enhance send API to support Telegram ID as recipient
xbuddhi Jul 15, 2025
3eb944a
Merge pull request #35 from CeyLabs/dev
xbuddhi Jul 15, 2025
bf4581c
feat: Refactor API to use wallet-based HMAC security and update confi…
xbuddhi Jul 17, 2025
9387be6
Merge pull request #37 from CeyLabs/dev
xbuddhi Jul 17, 2025
c60a10b
feat: Update transaction formatting to use third-party LKR conversion…
xbuddhi Jul 21, 2025
e8ed2b0
Merge pull request #39 from CeyLabs/dev
xbuddhi Jul 21, 2025
76f81ac
chore: remove deprecated test_pay_api.sh script
xbuddhi Jul 21, 2025
19155ba
feat: Update inline messages to format amounts using third-party LKR …
xbuddhi Jul 21, 2025
d574426
Merge pull request #40 from CeyLabs/dev
xbuddhi Jul 21, 2025
4c38970
fix: Correct inline message formatting by replacing strconv.Itoa with…
xbuddhi Jul 21, 2025
b33e015
Merge pull request #41 from CeyLabs/dev
xbuddhi Jul 21, 2025
4257417
feat: enable savings pots
helloscoopa Jul 21, 2025
8d6dd3b
fix: balance display and fiat calculation
helloscoopa Jul 21, 2025
e17152c
fix: race condition in duplicate and limit checks
helloscoopa Jul 21, 2025
4822155
fix: wallet balance updated without external transfer
helloscoopa Jul 21, 2025
1c1447a
fix: inconsistent pot name parsing
helloscoopa Jul 21, 2025
9ec2647
Merge pull request #38 from CeyLabs/main
xbuddhi Jul 22, 2025
66facb8
fix: add MinPotNameLength
helloscoopa Jul 22, 2025
a192609
fix: main balance deduction and addition
helloscoopa Jul 22, 2025
79d9347
fix: use i18n
helloscoopa Jul 22, 2025
eea7916
fix: set default balance vlaues
helloscoopa Jul 22, 2025
e015d48
refactor: use GORM auto-timestamps
helloscoopa Jul 22, 2025
77fac70
fix: Update API Send endpoint registration to remove unnecessary midd…
xbuddhi Jul 22, 2025
0058e9a
Merge pull request #43 from CeyLabs/dev
xbuddhi Jul 22, 2025
fc0db96
fix: Enhance Telegram ID validation and update username handling in A…
xbuddhi Jul 23, 2025
d8c51ae
Merge pull request #45 from CeyLabs/dev
xbuddhi Jul 23, 2025
3e323b7
fix: make pot transfer atomic
helloscoopa Jul 23, 2025
4a7b19a
fix: Refactor GetSatPrice to include LKR exchange rate calculation an…
xbuddhi Jul 23, 2025
5d4f4cd
Merge pull request #46 from CeyLabs/dev
xbuddhi Jul 23, 2025
22d9489
fix: Add error handling for HTTP request in GetUSDToLKRRate function
xbuddhi Jul 26, 2025
7e5cd0a
Merge pull request #47 from CeyLabs/dev
xbuddhi Jul 26, 2025
76c3541
fix: Refactor inline receive/send handling to support LKR amounts and…
xbuddhi Jul 27, 2025
e5d1116
Merge pull request #48 from CeyLabs/dev
xbuddhi Jul 27, 2025
e5c0680
fix: Update inline send result formatting to include LKR representation
xbuddhi Jul 27, 2025
c70af5a
Merge pull request #49 from CeyLabs/dev
xbuddhi Jul 27, 2025
9599e7a
feat: Add user balance API endpoint with wallet-based HMAC security
xbuddhi Jul 27, 2025
448231e
Merge pull request #50 from CeyLabs/dev
xbuddhi Jul 27, 2025
1e63eb5
fix: use gorm to manipulate wallet_balance
helloscoopa Aug 22, 2025
f82647d
Merge pull request #42 from CeyLabs/scoopa/savings-pots
xbuddhi Aug 22, 2025
d5a1610
fix: main balance display
helloscoopa Aug 22, 2025
97e21f9
fix: update /help response to include pots commands
helloscoopa Aug 22, 2025
f4968fd
fix: add usd/lkr values to main pot balance
helloscoopa Aug 22, 2025
9adf6e6
Merge pull request #51 from CeyLabs/main
xbuddhi Aug 22, 2025
24e15d1
fix: update deployment workflow to use 'dev' branch and streamline bu…
xbuddhi Aug 22, 2025
7e1c9b0
fix: update server configuration in deployment workflow
xbuddhi Aug 22, 2025
ca66a14
fix: remove conditional check for git existence before copying files …
xbuddhi Aug 22, 2025
3902725
fix: add conditional check for git existence before copying files to …
xbuddhi Aug 22, 2025
3b18b53
fix: disable VCS information in build output for cleaner binaries
xbuddhi Aug 22, 2025
d861576
fix: update user wallet balance handling in WithdrawFromPot function
xbuddhi Aug 22, 2025
9d29303
fix: update user balance handling in TransferToPot and WithdrawFromPo…
xbuddhi Aug 22, 2025
d7679a2
pot operation update
ceybuddhi Aug 23, 2025
47a2f99
fix: use available balance for debits
helloscoopa Aug 23, 2025
6bf287a
fix: typo in en.tmol
helloscoopa Aug 23, 2025
053b7f9
fix: text typo
helloscoopa Aug 23, 2025
ad69dea
feat: add fiat values in /pots
helloscoopa Aug 23, 2025
6b9251f
feat: enhance error logging with HTML formatting and add HTML escapin…
buddhiwann Oct 14, 2025
afc9c74
feat: enhance error logging with detailed HTML formatting and user/ch…
buddhiwann Oct 14, 2025
a9e0122
feat: add release workflow and GoReleaser configuration
buddhiwann Nov 28, 2025
0469453
feat: implement memo caching in Send API and enhance Cache utility
buddhiwann Nov 28, 2025
b1503de
feat: add duplicate memo check in Send API to prevent reprocessing tr…
buddhiwann Dec 1, 2025
e0a75bd
feat: update Telegram notification logic in release workflow to suppo…
buddhiwann Dec 1, 2025
debec87
ci: use Actions variables for release chat IDs (RELEASE_CHAT_IDS, DEV…
buddhiwann Dec 1, 2025
7ba9fb4
feat: implement memo locking mechanism in Send API to prevent duplica…
buddhiwann Dec 1, 2025
37dcf97
feat: add step to create local tag in release workflow
buddhiwann Dec 1, 2025
7d5f488
feat: update custom tag format in release workflow to include version…
buddhiwann Dec 1, 2025
13897a5
feat: update version tagging logic in release workflows to use calcul…
buddhiwann Dec 1, 2025
d85c77a
feat: upgrade setup-go action to v6 and use PR title in Telegram noti…
buddhiwann Dec 2, 2025
33f57cf
feat: update custom tag format in release workflow to use short SHA
buddhiwann Dec 2, 2025
c24dca7
feat: update custom tag format in release workflow to include version…
buddhiwann Dec 2, 2025
8cd60eb
feat: enhance Telegram notification to include PR body description
buddhiwann Dec 2, 2025
8a6c642
feat: implement standing order feature with creation, listing, and de…
mrcentimetre Mar 25, 2026
a48e50e
feat: update standing order help text and add command descriptions in…
mrcentimetre Mar 25, 2026
3adb6b9
feat: improve error message for standing order creation failure
mrcentimetre Mar 25, 2026
0562b7f
feat: add analytics API endpoints and filter empty telebot errors (#58)
xbuddhi Mar 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 173 additions & 0 deletions .github/workflows/build-deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@

name: BitcoinDeepaBot Deployment - Dev

on:
push:
branches:
- dev

defaults:
run:
working-directory: .

jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
GO_VERSION: "1.21"
PROJECT_NAME: "⚡ BitcoinDeepaBot - Dev"
DEPLOY_PATH: "/root/projects/ceyloncash/bitcoin-deepa/dev/"
PROJECT_DIR: "bitcoin-deepa-bot"
SERVICE_NAME: "bitcoin_deepa_bot_dev.service"
BINARY_NAME: "BitcoinDeepaBot"

steps:
- name: Notify Build Start
run: |
curl -s -X POST https://api.telegram.org/bot${{ secrets.DEV_ACTIONS_BOT_TOKEN }}/sendMessage \
-d chat_id="${{ secrets.DEV_ACTIONS_GROUP_ID }}" \
-d text="
${{ env.PROJECT_NAME }} Build Started 🚀
📁 Repository: ${{ github.repository }}
👤 Initiator: ${{ github.actor }}
🕒 Timestamp: ${{ github.event.head_commit.timestamp}}
📝 Commit Message: ${{ github.event.head_commit.message }}"

- name: Checkout Code
uses: actions/checkout@v4

- name: Notify Build Complete
run: |
curl -s -X POST https://api.telegram.org/bot${{ secrets.DEV_ACTIONS_BOT_TOKEN }}/sendMessage \
-d chat_id="${{ secrets.DEV_ACTIONS_GROUP_ID }}" \
-d text="
${{ env.PROJECT_NAME }} Code Checked Out �
📁 Repository: ${{ github.repository }}
👤 Initiator: ${{ github.actor }}
🕒 Timestamp: ${{ github.event.head_commit.timestamp }}
📝 Commit Message: ${{ github.event.head_commit.message }}"

# ✅ Check if .git directory exists remotely
- name: Check if Git Exists on Server
id: check_git
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_KEY }}
port: ${{ secrets.SERVER_PORT }}
script: |
if [ -d "${{ env.DEPLOY_PATH }}${{ env.PROJECT_DIR }}/.git" ]; then
echo "true"
else
echo "false"
fi

# ✅ Capture the above output
- name: Set git_exists output
id: set_git_output
run: echo "::set-output name=git_exists::$(echo '${{ steps.check_git.outputs.stdout }}' | tr -d '\r')"

- name: Copy Files to Server
if: steps.set_git_output.outputs.git_exists == 'false'
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_KEY }}
port: ${{ secrets.SERVER_PORT }}
source: "."
target: "${{ env.DEPLOY_PATH }}${{ env.PROJECT_DIR }}"
strip_components: 1
rm: true

- name: Deploy Application
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_KEY }}
port: ${{ secrets.SERVER_PORT }}
script: |
cd ${{ env.DEPLOY_PATH }}${{ env.PROJECT_DIR }}

# Handle git repository - pull if .git exists, otherwise fresh deployment
if [ -d ".git" ]; then
echo "Git repository exists, pulling latest changes..."
git fetch origin
git reset --hard origin/dev
git clean -fd
else
echo "Fresh deployment - no git repository found"
fi

# Set Go environment
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export GOOS=linux
export GOARCH=amd64

# Build the application on the server
echo "Building application on server..."
go mod download
go mod verify
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags="-w -s" -buildvcs=false -o ${{ env.BINARY_NAME }} .

# Make binary executable
chmod +x ${{ env.BINARY_NAME }}

# Update service definition
sudo bash -c 'cat > "/etc/systemd/system/${{ env.SERVICE_NAME }}" <<- EOM
[Unit]
Description=${{ env.PROJECT_NAME }}
After=network.target

[Service]
Type=simple
Restart=always
RestartSec=5s
WorkingDirectory=${{ env.DEPLOY_PATH }}${{ env.PROJECT_DIR }}
ExecStart=${{ env.DEPLOY_PATH }}${{ env.PROJECT_DIR }}/${{ env.BINARY_NAME }}
Environment=HOME=/root
User=root

[Install]
WantedBy=multi-user.target
EOM'

# Create data directory if it doesn't exist
mkdir -p data/dalle

# Reload systemd and restart service
sudo systemctl daemon-reload
sudo systemctl enable ${{ env.SERVICE_NAME }}
sudo systemctl restart ${{ env.SERVICE_NAME }}

# Wait a moment and check service status
sleep 3
sudo systemctl status ${{ env.SERVICE_NAME }} --no-pager

- name: Notify Deploy Complete
run: |
curl -s -X POST https://api.telegram.org/bot${{ secrets.DEV_ACTIONS_BOT_TOKEN }}/sendMessage \
-d chat_id="${{ secrets.DEV_ACTIONS_GROUP_ID }}" \
-d text="
${{ env.PROJECT_NAME }} Deploy Complete ✅
📁 Repository: ${{ github.repository }}
👤 Initiator: ${{ github.actor }}
🕒 Timestamp: ${{ github.event.head_commit.timestamp }}
📝 Commit Message: ${{ github.event.head_commit.message }}"

- name: Notify Deploy Failure
if: failure()
run: |
curl -s -X POST https://api.telegram.org/bot${{ secrets.DEV_ACTIONS_BOT_TOKEN }}/sendMessage \
-d chat_id="${{ secrets.DEV_ACTIONS_GROUP_ID }}" \
-d text="
❌ ${{ env.PROJECT_NAME }} Deploy Failed!
📁 Repository: ${{ github.repository }}
👤 Initiator: ${{ github.actor }}
🕒 Timestamp: ${{ github.event.head_commit.timestamp }}
📝 Commit Message: ${{ github.event.head_commit.message }}

Please check the GitHub Actions logs for more details."
173 changes: 173 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
name: BitcoinDeepaBot Deployment - Prod

on:
push:
branches:
- main

defaults:
run:
working-directory: .

jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
GO_VERSION: "1.21"
PROJECT_NAME: "⚡ BitcoinDeepaBot - Prod"
DEPLOY_PATH: "/root/projects/ceyloncash/bitcoin-deepa/prod/"
PROJECT_DIR: "bitcoin-deepa-bot"
SERVICE_NAME: "bitcoin_deepa_bot_prod.service"
BINARY_NAME: "BitcoinDeepaBot"

steps:
- name: Notify Build Start
run: |
curl -s -X POST https://api.telegram.org/bot${{ secrets.DEV_ACTIONS_BOT_TOKEN }}/sendMessage \
-d chat_id="${{ secrets.DEV_ACTIONS_GROUP_ID }}" \
-d text="
${{ env.PROJECT_NAME }} Build Started 🚀
📁 Repository: ${{ github.repository }}
👤 Initiator: ${{ github.actor }}
🕒 Timestamp: ${{ github.event.head_commit.timestamp}}
📝 Commit Message: ${{ github.event.head_commit.message }}"

- name: Checkout Code
uses: actions/checkout@v4

- name: Notify Build Complete
run: |
curl -s -X POST https://api.telegram.org/bot${{ secrets.DEV_ACTIONS_BOT_TOKEN }}/sendMessage \
-d chat_id="${{ secrets.DEV_ACTIONS_GROUP_ID }}" \
-d text="
${{ env.PROJECT_NAME }} Code Checked Out �
📁 Repository: ${{ github.repository }}
👤 Initiator: ${{ github.actor }}
🕒 Timestamp: ${{ github.event.head_commit.timestamp }}
📝 Commit Message: ${{ github.event.head_commit.message }}"

# ✅ Check if .git directory exists remotely
- name: Check if Git Exists on Server
id: check_git
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_KEY }}
port: ${{ secrets.SERVER_PORT }}
script: |
if [ -d "${{ env.DEPLOY_PATH }}${{ env.PROJECT_DIR }}/.git" ]; then
echo "true"
else
echo "false"
fi

# ✅ Capture the above output
- name: Set git_exists output
id: set_git_output
run: echo "::set-output name=git_exists::$(echo '${{ steps.check_git.outputs.stdout }}' | tr -d '\r')"


- name: Copy Files to Server
if: steps.set_git_output.outputs.git_exists == 'false'
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_KEY }}
port: ${{ secrets.SERVER_PORT }}
source: "."
target: "${{ env.DEPLOY_PATH }}${{ env.PROJECT_DIR }}"
strip_components: 1
rm: true

- name: Deploy Application
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_KEY }}
port: ${{ secrets.SERVER_PORT }}
script: |
cd ${{ env.DEPLOY_PATH }}${{ env.PROJECT_DIR }}

# Handle git repository - pull if .git exists, otherwise fresh deployment
if [ -d ".git" ]; then
echo "Git repository exists, pulling latest changes..."
git fetch origin
git reset --hard origin/main
git clean -fd
else
echo "Fresh deployment - no git repository found"
fi

# Set Go environment
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export GOOS=linux
export GOARCH=amd64

# Build the application on the server
echo "Building application on server..."
go mod download
go mod verify
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags="-w -s" -o ${{ env.BINARY_NAME }} .

# Make binary executable
chmod +x ${{ env.BINARY_NAME }}

# Update service definition
sudo bash -c 'cat > "/etc/systemd/system/${{ env.SERVICE_NAME }}" <<- EOM
[Unit]
Description=${{ env.PROJECT_NAME }}
After=network.target

[Service]
Type=simple
Restart=always
RestartSec=5s
WorkingDirectory=${{ env.DEPLOY_PATH }}${{ env.PROJECT_DIR }}
ExecStart=${{ env.DEPLOY_PATH }}${{ env.PROJECT_DIR }}/${{ env.BINARY_NAME }}
Environment=HOME=/root
User=root

[Install]
WantedBy=multi-user.target
EOM'

# Create data directory if it doesn't exist
mkdir -p data/dalle

# Reload systemd and restart service
sudo systemctl daemon-reload
sudo systemctl enable ${{ env.SERVICE_NAME }}
sudo systemctl restart ${{ env.SERVICE_NAME }}

# Wait a moment and check service status
sleep 3
sudo systemctl status ${{ env.SERVICE_NAME }} --no-pager

- name: Notify Deploy Complete
run: |
curl -s -X POST https://api.telegram.org/bot${{ secrets.DEV_ACTIONS_BOT_TOKEN }}/sendMessage \
-d chat_id="${{ secrets.DEV_ACTIONS_GROUP_ID }}" \
-d text="
${{ env.PROJECT_NAME }} Deploy Complete ✅
📁 Repository: ${{ github.repository }}
👤 Initiator: ${{ github.actor }}
🕒 Timestamp: ${{ github.event.head_commit.timestamp }}
📝 Commit Message: ${{ github.event.head_commit.message }}"

- name: Notify Deploy Failure
if: failure()
run: |
curl -s -X POST https://api.telegram.org/bot${{ secrets.DEV_ACTIONS_BOT_TOKEN }}/sendMessage \
-d chat_id="${{ secrets.DEV_ACTIONS_GROUP_ID }}" \
-d text="
❌ ${{ env.PROJECT_NAME }} Deploy Failed!
📁 Repository: ${{ github.repository }}
👤 Initiator: ${{ github.actor }}
🕒 Timestamp: ${{ github.event.head_commit.timestamp }}
📝 Commit Message: ${{ github.event.head_commit.message }}

Please check the GitHub Actions logs for more details."
Loading