Skip to content

Commit

Permalink
v1.0.0 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jftuga committed Jul 10, 2024
1 parent 143e445 commit e00bf77
Show file tree
Hide file tree
Showing 19 changed files with 1,672 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
workflow_dispatch:
push:
tags:
- "*"

permissions:
contents: write

jobs:
build:
name: GoReleaser Build
runs-on: ubuntu-latest

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set Up Go
uses: actions/setup-go@v5
with:
go-version: "1.x"
id: go

- name: run GoReleaser
uses: goreleaser/goreleaser-action@v6
env:
HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: release --clean
87 changes: 87 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
version: 2

before:
hooks:
- go mod tidy

builds:
- id: dtmate
binary: dtmate
dir: ./cmd/dtmate
ldflags:
- -extldflags "-static" -s -w -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}}
env:
- CGO_ENABLED=0
goos:
- linux
- freebsd
- darwin
goarch:
- amd64
- arm64
- arm
- ppc64le
goarm:
- "7"
ignore:
- goos: freebsd
goarch: arm64
- goos: freebsd
goarch: arm
- goos: freebsd
goarch: ppc64le
- goos: darwin
goarch: arm
- goos: darwin
goarch: ppc64le

- id: dtmate-win
binary: dtmate
dir: ./cmd/dtmate
ldflags:
- -extldflags "-static" -s -w -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}}
env:
- CGO_ENABLED=0
goos:
- windows
goarch:
- amd64
hooks:
post:
- upx -9 "{{ .Path }}"

archives:
- name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
format: tar.xz
format_overrides:
- goos: windows
format: zip
wrap_in_directory: true
files:
- LICENSE
- README.md

checksum:
name_template: "{{ .ProjectName }}_{{ .Version }}--checksums.txt"
release:
draft: false
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

brews:
- name: dtmate
repository:
owner: jftuga
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TOKEN }}"
commit_author:
name: jftuga
email: jftuga@users.noreply.github.com
homepage: https://github.com/jftuga/DateTimeMate
description: "dtmate: output the difference between date, time or duration"
test: system "#{bin}/dtmate -v"
install: bin.install "dtmate"
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/DateTimeMate.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions DateTimeMate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package DateTimeMate

import (
"github.com/golang-module/carbon/v2"
"strings"
)

const (
ModName string = "DateTimeMate"
ModVersion string = "1.0.0"
ModUrl string = "https://github.com/jftuga/DateTimeMate"
)

// convertRelativeDateToActual converts "yesterday", "today", "tomorrow"
// into actual dates; yesterday and tomorrow are -/+ 24 hours of current time
func convertRelativeDateToActual(from string) string {
switch strings.ToLower(from) {
case "now":
return carbon.Now().String()
case "today":
return carbon.Now().String()
case "yesterday":
return carbon.Yesterday().String()
case "tomorrow":
return carbon.Tomorrow().String()
}
return from
}
Loading

0 comments on commit e00bf77

Please sign in to comment.