-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add config options for frequency, eventdays and emailhours * add taskfile to build and publish
- Loading branch information
Showing
7 changed files
with
88 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
builds/ | ||
.env | ||
config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,12 @@ | |
"users": [ | ||
{ | ||
"name": "user1", | ||
"frequency": "1h", | ||
"caldav": { | ||
"url": "https://caldav.example.com/calendars/user1/xyz/", | ||
"username": "user1", | ||
"password": "password1" | ||
"password": "password1", | ||
"eventDays": 5 | ||
}, | ||
"smtp": { | ||
"host": "mail.example.org", | ||
|
@@ -15,7 +17,8 @@ | |
"imap": { | ||
"host": "mail.example.org", | ||
"username": "[email protected]", | ||
"password": "password1" | ||
"password": "password1", | ||
"emailHours": 6 | ||
} | ||
} | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package config | ||
|
||
import ( | ||
"encoding/json" | ||
"os" | ||
) | ||
|
||
type config struct { | ||
Users []User `json:"users"` | ||
} | ||
|
||
// loadConfig reads and returns the json config | ||
func loadConfig(path string) (config, error) { | ||
var conf config | ||
data, err := os.ReadFile(path) | ||
if err != nil { | ||
return conf, err | ||
} | ||
err = json.Unmarshal(data, &conf) | ||
return conf, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
version: '3' | ||
|
||
vars: | ||
NEXT_VERSION: | ||
sh: | | ||
VERSION=$(git tag --sort=-v:refname | head -n 1) | ||
MAJOR=$(echo $VERSION | cut -d. -f1) | ||
MINOR=$(echo $VERSION | cut -d. -f2) | ||
PATCH=$(echo $VERSION | cut -d. -f3) | ||
NEW_TAG="$MAJOR.$MINOR.$((PATCH+1))" | ||
echo "$NEW_TAG" | ||
tasks: | ||
build: | ||
desc: Build the binary for different platforms | ||
cmds: | ||
- go mod tidy | ||
- GOOS=darwin GOARCH=arm64 go build -o builds/calbridge-darwin-arm64 cmd/main.go | ||
- GOOS=linux GOARCH=amd64 go build -o builds/calbridge-linux-amd64 cmd/main.go | ||
- GOOS=linux GOARCH=arm64 go build -o builds/calbridge-linux-arm64 cmd/main.go | ||
env: | ||
CGO_ENABLED: 0 | ||
|
||
release: | ||
desc: Create a new GitHub release and upload binaries | ||
cmds: | ||
- | | ||
VERSION=${VERSION_OVERRIDE:-{{.NEXT_VERSION}}} | ||
gh release create "$VERSION" builds/* --title "Release $VERSION" --notes "Release $VERSION" | ||
- git fetch --tags | ||
env: | ||
VERSION_OVERRIDE: '' | ||
|
||
all: | ||
desc: Build and release | ||
cmds: | ||
- task: build | ||
- task: release |