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:
|
||||
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:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v4
|
||||
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
|
||||
run: go build -v ./...
|
||||
run: make build
|
||||
|
||||
- name: Test
|
||||
run: go test -v ./...
|
||||
@@ -38,4 +38,4 @@ jobs:
|
||||
if [ -n "$(golint./...)" ]; then
|
||||
echo "Go code has style issues. Please run 'golint./...' to see them."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
/twilio_sender
|
||||
/sender
|
||||
/messages
|
||||
/numbers
|
||||
/twilio_details.json
|
||||
/config.json
|
||||
|
||||
+7
-7
@@ -12,7 +12,7 @@ image: golang:1.24
|
||||
stages:
|
||||
- test
|
||||
- build
|
||||
- deploy
|
||||
# - deploy
|
||||
|
||||
format:
|
||||
stage: test
|
||||
@@ -24,13 +24,13 @@ format:
|
||||
compile:
|
||||
stage: build
|
||||
script:
|
||||
- mkdir -p mybinaries
|
||||
- go build -o mybinaries ./...
|
||||
- make build
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- mybinaries
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
script: echo "Define your deployment script!"
|
||||
environment: production
|
||||
# deploy:
|
||||
# stage: deploy
|
||||
# script: echo "Define your deployment script!"
|
||||
# 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
|
||||
twilio_sender is a cli program to send text messages.
|
||||
# sender
|
||||
sender is a cli program to send text messages.
|
||||
|
||||
## Install twilio
|
||||
```
|
||||
go build
|
||||
make build
|
||||
```
|
||||
|
||||
## 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 (
|
||||
"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) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module git.kundeng.us/phoenix/twilio_sender
|
||||
module git.kundeng.us/phoenix/sender
|
||||
|
||||
go 1.24.4
|
||||
|
||||
|
||||
@@ -4,14 +4,17 @@ import "fmt"
|
||||
import "os"
|
||||
|
||||
import (
|
||||
"git.kundeng.us/phoenix/twilio_sender/config"
|
||||
"git.kundeng.us/phoenix/twilio_sender/models"
|
||||
"git.kundeng.us/phoenix/twilio_sender/sender"
|
||||
"git.kundeng.us/phoenix/twilio_sender/util"
|
||||
// "flag"
|
||||
|
||||
"git.kundeng.us/phoenix/sender/config"
|
||||
"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() {
|
||||
fmt.Println("twilio_sender")
|
||||
fmt.Println(config.App_Name)
|
||||
myArgs := os.Args
|
||||
argCount := len(myArgs)
|
||||
|
||||
@@ -26,6 +29,16 @@ func main() {
|
||||
|
||||
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.PrintConfig()
|
||||
@@ -53,5 +66,5 @@ func main() {
|
||||
|
||||
message.Print()
|
||||
|
||||
sender.SendMessages(cfg, numbers, message, 5)
|
||||
messaging.SendMessages(cfg, numbers, message, 5)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package sender
|
||||
package messaging
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -7,7 +7,8 @@ import (
|
||||
|
||||
"github.com/twilio/twilio-go"
|
||||
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) {
|
||||
+1
-1
@@ -9,7 +9,7 @@ if [[ ! -d "$root_dir" ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
config_path="twilio_details.json"
|
||||
config_path="config.json"
|
||||
numbers_part="0"
|
||||
numbers_path="numbers/numbers-$numbers_part.json"
|
||||
type_message="json"
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import "os"
|
||||
import "strings"
|
||||
|
||||
import (
|
||||
"git.kundeng.us/phoenix/twilio_sender/models"
|
||||
"git.kundeng.us/phoenix/sender/models"
|
||||
)
|
||||
|
||||
func GetPaths(args []string) (configPath string, numberPath string, messagePath string) {
|
||||
|
||||
Reference in New Issue
Block a user