diff --git a/.gitea/workflows/build-docker.yaml b/.gitea/workflows/build-docker.yaml
new file mode 100644
index 0000000..ca1468f
--- /dev/null
+++ b/.gitea/workflows/build-docker.yaml
@@ -0,0 +1,50 @@
+name: Build Docker Image
+on:
+ push:
+ branches:
+ - main
+
+jobs:
+ build:
+ strategy:
+ matrix:
+ arch:
+ - amd64
+
+ runs-on: ${{ matrix.arch }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0 # Fetch full history, keeping all commits
+
+ - name: Get commit count
+ id: get_commit_count
+ run: |
+ COMMIT_COUNT=$(git rev-list --count HEAD)
+ echo "COMMIT_COUNT=${COMMIT_COUNT}" >> $GITHUB_ENV
+
+ - name: Prepare code
+ run: |
+ echo "Preparing versioning"
+ echo "package configs" > internal/configs/version.go
+ echo "var Version = \"${{ env.COMMIT_COUNT }}\"" >> internal/configs/version.go
+
+ - name: Login to Docker Registry
+ uses: docker/login-action@v3
+ with:
+ registry: git.thuanle.me
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+
+ - name: Build Docker images
+ run: |
+ echo "Building image for architecture: ${{ matrix.arch }} with commit count: ${{ env.COMMIT_COUNT }}"
+ docker build -f Dockerfile \
+ -t git.thuanle.me/public/crypto-price-bot:${{ matrix.arch }}-${{ env.COMMIT_COUNT }} \
+ -t git.thuanle.me/public/crypto-price-bot:latest \
+ .
+
+ docker push git.thuanle.me/public/crypto-price-bot:${{ matrix.arch }}-${{ env.COMMIT_COUNT }}
+ docker push git.thuanle.me/public/crypto-price-bot:latest
+
diff --git a/.idea/crypto-price-bot.iml b/.idea/crypto-price-bot.iml
new file mode 100644
index 0000000..5e764c4
--- /dev/null
+++ b/.idea/crypto-price-bot.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..2769571
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/internal/configs/version.go b/internal/configs/version.go
new file mode 100644
index 0000000..6cc56b1
--- /dev/null
+++ b/internal/configs/version.go
@@ -0,0 +1,3 @@
+package configs
+
+var Version = "2"
diff --git a/internal/services/tele/command.go b/internal/services/tele/command.go
index ff50cf2..86c1277 100644
--- a/internal/services/tele/command.go
+++ b/internal/services/tele/command.go
@@ -31,7 +31,7 @@ func setupCommands(b *telebot.Bot) error {
b.Handle("/start", commands.OnStart)
//general
- b.Handle("/ip", commands.OnGetIp)
+ b.Handle("/v", commands.OnGetVersion)
//info
b.Handle("/p", commands.OnGetTopPrices)
diff --git a/internal/services/tele/commands/general.go b/internal/services/tele/commands/general.go
index 371c4a4..21f04c8 100644
--- a/internal/services/tele/commands/general.go
+++ b/internal/services/tele/commands/general.go
@@ -2,11 +2,13 @@ package commands
import (
"gopkg.in/telebot.v3"
+ "me.thuanle/bbot/internal/configs"
"me.thuanle/bbot/internal/services/tele/chat"
"me.thuanle/bbot/internal/utils/netx"
)
-func OnGetIp(context telebot.Context) error {
+func OnGetVersion(context telebot.Context) error {
ip := netx.GetPublicIp()
- return chat.ReplyMessageCode(context, ip)
+ msg := "v" + configs.Version + " - " + ip
+ return chat.ReplyMessageCode(context, msg)
}