Merge pull request 'fix(ci): update deploy workflows' (#22) from dev into main
Reviewed-on: #22
This commit was merged in pull request #22.
This commit is contained in:
53
.gitea/workflows/main.yaml
Normal file
53
.gitea/workflows/main.yaml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
name: Build and deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: smallbuster/request-bot:latest
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Pull Docker image from Docker Hub
|
||||||
|
run: |
|
||||||
|
docker pull smallbuster/request-bot:latest
|
||||||
|
|
||||||
|
- name: Stop and remove existing container
|
||||||
|
run: |
|
||||||
|
docker stop request-bot || true && docker rm request-bot || true
|
||||||
|
|
||||||
|
- name: Run Docker container
|
||||||
|
run: |
|
||||||
|
docker run -d --restart unless-stopped \
|
||||||
|
-e EMAIL_ADDRESS=${{secrets.EMAIL_ADDRESS}} \
|
||||||
|
-e EMAIL_PASSWORD=${{secrets.EMAIL_PASSWORD}} \
|
||||||
|
-e EMAIL_IMAP_SERVER=${{secrets.EMAIL_IMAP_SERVER}} \
|
||||||
|
-e EMAIL_IMAP_SERVER_PORT=${{secrets.EMAIL_IMAP_SERVER_PORT}} \
|
||||||
|
-e TELEGRAM_BOT_TOKEN=${{secrets.TELEGRAM_BOT_TOKEN}} \
|
||||||
|
-e TELEGRAM_GROUP_ID=${{secrets.TELEGRAM_GROUP_ID}} \
|
||||||
|
-e MARK_STRING=${{secrets.MARK_STRING}} \
|
||||||
|
-e POLLING_TIMEOUT=${{secrets.POLLING_TIMEOUT}} \
|
||||||
|
--name request-bot smallbuster/request-bot:latest
|
||||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "requestbot",
|
"name": "requestbot",
|
||||||
"version": "0.1.0",
|
"version": "0.7.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "requestbot",
|
"name": "requestbot",
|
||||||
"version": "0.1.0",
|
"version": "0.7.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chalk": "^4.1.2",
|
"chalk": "^4.1.2",
|
||||||
@@ -125,6 +125,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.11.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.11.tgz",
|
||||||
"integrity": "sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw==",
|
"integrity": "sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~5.26.4"
|
"undici-types": "~5.26.4"
|
||||||
}
|
}
|
||||||
@@ -1346,6 +1347,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
|
||||||
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
|
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
|
|||||||
16
src/index.ts
16
src/index.ts
@@ -45,13 +45,13 @@ const main = async () => {
|
|||||||
|
|
||||||
let {title, groupName, subject, user, estimatedDate, estimatedTime} = parseMessage(parsed.text)
|
let {title, groupName, subject, user, estimatedDate, estimatedTime} = parseMessage(parsed.text)
|
||||||
|
|
||||||
console.log(
|
// console.log(
|
||||||
`📌 Новое обращение: ${title}`, '\n',
|
// `📌 Новое обращение: ${title}`, '\n',
|
||||||
`Группа: ${groupName}`, '\n',
|
// `Группа: ${groupName}`, '\n',
|
||||||
`${user}`, '\n',
|
// `${user}`, '\n',
|
||||||
`${subject}`, '\n',
|
// `${subject}`, '\n',
|
||||||
`Время выполнения: ${estimatedDate} ${estimatedTime}`, '\n'
|
// `Время выполнения: ${estimatedDate} ${estimatedTime}`, '\n'
|
||||||
)
|
// )
|
||||||
|
|
||||||
const preparedMessage =
|
const preparedMessage =
|
||||||
`📌 Новое обращение: ${title}\n` +
|
`📌 Новое обращение: ${title}\n` +
|
||||||
@@ -77,7 +77,7 @@ const main = async () => {
|
|||||||
} finally {
|
} finally {
|
||||||
lock.release(); // mandatory release mailbox
|
lock.release(); // mandatory release mailbox
|
||||||
await client.logout(); // log out and close connection
|
await client.logout(); // log out and close connection
|
||||||
console.log('🧡', chalk.cyan('Heartbeat is ok'))
|
//console.log('🧡', chalk.cyan('Heartbeat is ok'))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user