tsk-7: Change name of repo (#8)
Closes #7 Reviewed-on: #8 Co-authored-by: phoenix <kundeng00@pm.me> Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
@@ -8,18 +8,18 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest # You can change this to macos-latest or windows-latest if needed
|
runs-on: ubuntu-24.04 # You can change this to macos-latest or windows-latest if needed
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 'stable' # You can specify a specific version or 'stable'
|
go-version: '1.24.4' # You can specify a specific version or 'stable'
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: go build -v ./...
|
run: make build
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: go test -v ./...
|
run: go test -v ./...
|
||||||
@@ -38,4 +38,4 @@ jobs:
|
|||||||
if [ -n "$(golint./...)" ]; then
|
if [ -n "$(golint./...)" ]; then
|
||||||
echo "Go code has style issues. Please run 'golint./...' to see them."
|
echo "Go code has style issues. Please run 'golint./...' to see them."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
/twilio_sender
|
/sender
|
||||||
/messages
|
/messages
|
||||||
/numbers
|
/numbers
|
||||||
/twilio_details.json
|
/config.json
|
||||||
|
|||||||
+7
-7
@@ -12,7 +12,7 @@ image: golang:1.24
|
|||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
- build
|
- build
|
||||||
- deploy
|
# - deploy
|
||||||
|
|
||||||
format:
|
format:
|
||||||
stage: test
|
stage: test
|
||||||
@@ -24,13 +24,13 @@ format:
|
|||||||
compile:
|
compile:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- mkdir -p mybinaries
|
- make build
|
||||||
- go build -o mybinaries ./...
|
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- mybinaries
|
- mybinaries
|
||||||
|
|
||||||
deploy:
|
# deploy:
|
||||||
stage: deploy
|
# stage: deploy
|
||||||
script: echo "Define your deployment script!"
|
# script: echo "Define your deployment script!"
|
||||||
environment: production
|
# environment: production
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
VERSION ?= $(shell git describe --tags 2>/dev/null || echo "dev")
|
||||||
|
COMMIT ?= $(shell git rev-parse --short HEAD)
|
||||||
|
BUILD_TIME ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||||
|
GO_VERSION ?= $(shell go version | awk '{print $$3}')
|
||||||
|
|
||||||
|
.PHONY: build
|
||||||
|
build:
|
||||||
|
go build -ldflags="\
|
||||||
|
-X 'git.kundeng.us/phoenix/sender/version.Version=$(VERSION)' \
|
||||||
|
-X 'git.kundeng.us/phoenix/sender/version.BuildTime=$(BUILD_TIME)' \
|
||||||
|
-X 'git.kundeng.us/phoenix/sender/version.Commit=$(COMMIT)' \
|
||||||
|
-X 'git.kundeng.us/phoenix/sender/version.GoVersion=$(GO_VERSION)'" \
|
||||||
|
-o sender main.go
|
||||||
|
|
||||||
|
.PHONY: install
|
||||||
|
install:
|
||||||
|
go install -ldflags="\
|
||||||
|
-X 'git.kundeng.us/phoenix/sender/version.Version=$(VERSION)' \
|
||||||
|
-X 'git.kundeng.us/phoenix/sender/version.BuildTime=$(BUILD_TIME)' \
|
||||||
|
-X 'git.kundeng.us/phoenix/sender/version.Commit=$(COMMIT)' \
|
||||||
|
-X 'git.kundeng.us/phoenix/sender/version.GoVersion=$(GO_VERSION)'"
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
# twilio_sender
|
# sender
|
||||||
twilio_sender is a cli program to send text messages.
|
sender is a cli program to send text messages.
|
||||||
|
|
||||||
## Install twilio
|
## Install twilio
|
||||||
```
|
```
|
||||||
go build
|
make build
|
||||||
```
|
```
|
||||||
|
|
||||||
## Using
|
## Using
|
||||||
```
|
```
|
||||||
./twilio_sender config_path.json numbers_path.json message_path.json
|
./sender config_path.json numbers_path.json message_path.json
|
||||||
```
|
```
|
||||||
|
|||||||
+5
-1
@@ -5,7 +5,11 @@ import "fmt"
|
|||||||
import "os"
|
import "os"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.kundeng.us/phoenix/twilio_sender/models"
|
"git.kundeng.us/phoenix/sender/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
App_Name = "sender"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ParseConfig(filepath string) (config models.TwiloDetails, success bool) {
|
func ParseConfig(filepath string) (config models.TwiloDetails, success bool) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module git.kundeng.us/phoenix/twilio_sender
|
module git.kundeng.us/phoenix/sender
|
||||||
|
|
||||||
go 1.24.4
|
go 1.24.4
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,17 @@ import "fmt"
|
|||||||
import "os"
|
import "os"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.kundeng.us/phoenix/twilio_sender/config"
|
// "flag"
|
||||||
"git.kundeng.us/phoenix/twilio_sender/models"
|
|
||||||
"git.kundeng.us/phoenix/twilio_sender/sender"
|
"git.kundeng.us/phoenix/sender/config"
|
||||||
"git.kundeng.us/phoenix/twilio_sender/util"
|
"git.kundeng.us/phoenix/sender/messaging"
|
||||||
|
"git.kundeng.us/phoenix/sender/models"
|
||||||
|
"git.kundeng.us/phoenix/sender/util"
|
||||||
|
// "git.kundeng.us/phoenix/sender/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("twilio_sender")
|
fmt.Println(config.App_Name)
|
||||||
myArgs := os.Args
|
myArgs := os.Args
|
||||||
argCount := len(myArgs)
|
argCount := len(myArgs)
|
||||||
|
|
||||||
@@ -26,6 +29,16 @@ func main() {
|
|||||||
|
|
||||||
fmt.Printf("Config file path: %s\n", configPath)
|
fmt.Printf("Config file path: %s\n", configPath)
|
||||||
|
|
||||||
|
// TODO: For version
|
||||||
|
/*
|
||||||
|
versionFlag := flag.Bool("version", false, "Print version information")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
if *versionFlag {
|
||||||
|
fmt.Println(version.String())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
*/
|
||||||
cfg, _ := config.ParseConfig(configPath)
|
cfg, _ := config.ParseConfig(configPath)
|
||||||
|
|
||||||
cfg.PrintConfig()
|
cfg.PrintConfig()
|
||||||
@@ -53,5 +66,5 @@ func main() {
|
|||||||
|
|
||||||
message.Print()
|
message.Print()
|
||||||
|
|
||||||
sender.SendMessages(cfg, numbers, message, 5)
|
messaging.SendMessages(cfg, numbers, message, 5)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package sender
|
package messaging
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@@ -7,7 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/twilio/twilio-go"
|
"github.com/twilio/twilio-go"
|
||||||
twilioApi "github.com/twilio/twilio-go/rest/api/v2010"
|
twilioApi "github.com/twilio/twilio-go/rest/api/v2010"
|
||||||
"git.kundeng.us/phoenix/twilio_sender/models"
|
|
||||||
|
"git.kundeng.us/phoenix/sender/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SendMessages(config models.TwiloDetails, numbers [](models.Number), message models.Message, secondInterval int) {
|
func SendMessages(config models.TwiloDetails, numbers [](models.Number), message models.Message, secondInterval int) {
|
||||||
+1
-1
@@ -9,7 +9,7 @@ if [[ ! -d "$root_dir" ]]; then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config_path="twilio_details.json"
|
config_path="config.json"
|
||||||
numbers_part="0"
|
numbers_part="0"
|
||||||
numbers_path="numbers/numbers-$numbers_part.json"
|
numbers_path="numbers/numbers-$numbers_part.json"
|
||||||
type_message="json"
|
type_message="json"
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ import "os"
|
|||||||
import "strings"
|
import "strings"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.kundeng.us/phoenix/twilio_sender/models"
|
"git.kundeng.us/phoenix/sender/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetPaths(args []string) (configPath string, numberPath string, messagePath string) {
|
func GetPaths(args []string) (configPath string, numberPath string, messagePath string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user