diff --git a/.github/workflows/develop.yaml b/.github/workflows/develop.yaml index c16342b..9c97126 100644 --- a/.github/workflows/develop.yaml +++ b/.github/workflows/develop.yaml @@ -11,10 +11,10 @@ on: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: - go: [ '1.16', '1.17' ] + go: [ '1.19', '1.20', '1.21' ] name: Go ${{ matrix.go }} sample steps: - name: Setup go diff --git a/.goreleaser.yml b/.goreleaser.yml deleted file mode 100644 index 7fad788..0000000 --- a/.goreleaser.yml +++ /dev/null @@ -1,85 +0,0 @@ -project_name: zap-pretty - -release: - github: - owner: maoueh - name: zap-pretty - name_template: '{{.Tag}}' -builds: - - id: zap-pretty - goos: - - linux - - darwin - - windows - goarch: - - arm64 - - amd64 - targets: - - linux_amd64 - - darwin_amd64 - - darwin_arm64 - - windows_amd64 - main: ./ - ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} - binary: zap-pretty - env: - - CGO_ENABLED=0 - -archives: - # sfeth - - name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' - id: zap-pretty - builds: - - zap-pretty - replacements: - amd64: x86_64 - darwin: macOS - linux: linux - format: tar.gz - files: - - LICENSE.md - - README.md - -snapshot: - name_template: '{{ .Tag }}-next' - -checksum: - name_template: checksums.txt - -changelog: - filters: - exclude: - - '^docs:' - - '^test:' - sort: asc - -dist: dist - -signs: -- cmd: keybase - args: - - sign - - --infile - - $artifact - - --binary - - --outfile - - $signature - - --detached - signature: ${artifact}.sig - artifacts: checksum -env_files: - github_token: ~/.config/goreleaser/github_token -brews: - - name: zap-pretty - ids: - - zap-pretty - tap: - owner: maoueh - name: homebrew-tap - commit_author: - name: goreleaserbot - email: matthieu.o.vachon@gmail.com - homepage: "https://github.com/maoueh/zap-pretty" - description: "A tiny binary to pretty-print Zap production JSON lines" - license: "MIT" - diff --git a/.sfreleaser b/.sfreleaser new file mode 100755 index 0000000..5ff2773 --- /dev/null +++ b/.sfreleaser @@ -0,0 +1,6 @@ +global: + binary: zap-pretty + language: golang + variant: application +release: + brew-tap-repo: maoueh/zap-pretty \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a59bca..ccf5092 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ -## Unreleased +## 0.4.0 (October 2nd, 2023) -- [Fix] Fix formatting when `timestamp` is unix timestamp and not string value +- [Fix] Fix formatting when `timestamp` is unix timestamp and not string value. ## 0.3.0 (April 21th, 2021) diff --git a/bin/release.sh b/bin/release.sh deleted file mode 100755 index 0e1494c..0000000 --- a/bin/release.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env bash - -ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" - -dry_run="" -force="false" - -main() { - pushd "$ROOT" &> /dev/null - - while getopts "hnf" opt; do - case $opt in - h) usage && exit 0;; - n) dry_run="true";; - f) force="true";; - \?) usage_error "Invalid option: -$OPTARG";; - esac - done - shift $((OPTIND-1)) - - verify_github_token - verify_keybase - - if [[ "$dry_run" == "true" && "$force" == "true" ]]; then - usage_error "Only one of -n (dry run) or -f (force) can be provided at a time" - fi - - version="$1"; shift - if [[ "$version" == "" ]]; then - printf "What version do you want to release (current latest is `git describe --tags --abbrev=0`)? " - read version - fi - - if [[ ! "$version" =~ ^v ]]; then - echo "Version $version is invalid, must start with a 'v'" - exit 1 - fi - - mode="Dry Run, use -f flag to switch to publishing mode" - if [[ "$force" == "true" ]]; then - mode="Publishing" - fi - - echo "About to release version tagged $version ($mode)" - sleep 3 - - if [[ "$force" == "true" ]]; then - echo "Pushing to ensure GitHub knowns about the latest commit(s)" - git push - fi - - args="--rm-dist" - if [[ "$force" == "false" ]]; then - args="--skip-publish --skip-validate $args" - fi - - set -e - git tag "$version" - set +e - - goreleaser release $args - if [[ $? -gt 0 || "$force" == "false" ]]; then - git tag -d "$version" - fi -} - -verify_github_token() { - if [[ ! -f "$HOME/.config/goreleaser/github_token" && "$GITHUB_TOKEN" = "" ]]; then - echo "No GitHub token could be found in enviornment variable GITHUB_TOKEN" - echo "nor at ~/.config/goreleaser/github_token." - echo "" - echo "You will need to create one on GitHub website and make it available through" - echo "one of the accept way mentionned above." - exit 1 - fi -} - -verify_keybase() { - if ! command keybase &> /dev/null; then - echo "Keybase is required to sign the release (the checksum of all the artifacts" - echo "to be precise)." - echo "" - echo "You will need to have it available ('brew install keybase' on Mac OS X) and" - echo "configure it, just setting your Git username and a password should be enough." - exit 1 - fi -} - -usage_error() { - message="$1" - exit_code="$2" - - echo "ERROR: $message" - echo "" - usage - exit ${exit_code:-1} -} - -usage() { - echo "usage: release.sh [-h] [-f] [-n] []" - echo "" - echo "Perform the necessary commands to perform a release of the project." - echo "The is optional, if not provided, you'll be asked the question." - echo "" - echo "The release being performed against GitHub, you need a valid GitHub API token" - echo "with the necessary rights to upload release and push to repositories. It needs to" - echo "be provided in file ~/.config/goreleaser/github_token or through an environment" - echo "variable GITHUB_TOKEN." - echo "" - echo "Keybase is required to sign the release (the checksum of all the artifacts" - echo "to be precise)." - echo "" - echo "You will need to have it available ('brew install keybase' on Mac OS X) and" - echo "configure it, just setting your Git username and a password should be enough." - echo "" - echo "Options" - echo " -f Run in write mode publishing the release to GitHub" - echo " -n Run in dry-run mode skipping validation and publishing" - echo " -h Display help about this script" -} - -main "$@" \ No newline at end of file diff --git a/go.mod b/go.mod index 39a6dbd..ced439e 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,14 @@ module github.com/maoueh/zap-pretty -go 1.16 +go 1.18 require ( github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 github.com/stretchr/testify v1.3.0 golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e ) + +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect +) diff --git a/go.sum b/go.sum index efa065b..9db0c10 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e h1:9MlwzLdW7QSDrhDjFlsEYmxpFyIoXmYRon3dt0io31k= -github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=