From ee317830f33e0d478fb0a67f8f5dc4da5775f5b7 Mon Sep 17 00:00:00 2001 From: Fedorov Vladimir Date: Sat, 11 Mar 2023 15:35:23 +0700 Subject: [PATCH] init --- .drone.yml | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ .fleet/run.json | 12 +++++++++++ go.mod | 3 +++ main.go | 7 ++++++ 4 files changed, 79 insertions(+) create mode 100644 .drone.yml create mode 100644 .fleet/run.json create mode 100644 go.mod create mode 100644 main.go diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..222adae --- /dev/null +++ b/.drone.yml @@ -0,0 +1,57 @@ +kind: pipeline +type: docker +name: default + +steps: + - name: build + image: golang + commands: + - go build -o valera_tg_bot main.go + + - name: scp + image: appleboy/drone-scp + settings: + host: + from_secret: server_ip + username: + from_secret: ssh_user + key: + from_secret: ssh_key + port: + from_secret: ssh_port + target: + - deploys/valera_tg_bot + source: + - valera_tg_bot + rm: true + + - name: deploy + image: appleboy/drone-ssh + environment: + TOKEN: + from_secret: bot_token + TOKEN_WEATHER: + from_secret: bot_token_weather + CHAT_ID: + from_secret: bot_chat_id + PASSWORD: + from_secret: ssh_pass + settings: + host: + from_secret: server_ip + username: + from_secret: ssh_user + key: + from_secret: ssh_key + port: + from_secret: ssh_port + envs: [ TOKEN,TOKEN_WEATHER,CHAT_ID,PASSWORD ] + command_timeout: 10s + script: + - cd deploys/valera_tg_bot + - echo $${TOKEN} > token.txt + - echo $${PASSWORD} | sudo -S systemctl restart valera + +trigger: + event: + - push \ No newline at end of file diff --git a/.fleet/run.json b/.fleet/run.json new file mode 100644 index 0000000..6c4c11d --- /dev/null +++ b/.fleet/run.json @@ -0,0 +1,12 @@ +{ + "configurations": [ + { + "type": "go", + "name": "run", + "goExecPath": "/usr/local/go/bin/go", + "buildParams": [ + "$PROJECT_DIR$/main.go", + ], + }, + ] +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..c97f920 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module valera + +go 1.17 diff --git a/main.go b/main.go new file mode 100644 index 0000000..0452af2 --- /dev/null +++ b/main.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("Hello, Go!") +}