Skip to content

Commit

Permalink
Slim and full binary (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
sj14 authored Feb 21, 2021
1 parent acf6bde commit 21194f8
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 30 deletions.
26 changes: 12 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@ name: Release
on:
push:
tags:
- '*'
- "*"

jobs:
release:
name: Release on GitHub
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1

- name: Validates GO releaser config
uses: docker://goreleaser/goreleaser:latest
- name: Checkout
uses: actions/checkout@v2
with:
args: check

- name: Create release on GitHub
uses: docker://goreleaser/goreleaser:latest
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
args: release
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{secrets.GORELEASER_GITHUB_TOKEN}}
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
60 changes: 46 additions & 14 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ before:
- go mod download
builds:
- main: ./main.go
#binary: epoch
#ldflags:
# Default is `-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser`.
# - "-s -w -X main.versionStr=$(git describe --always --tags --long --dirty)" # add version string # TODO: Fails. Maybe the git version in CI is too old and doesn't support one of the flags.
id: "epoch"
env:
- CGO_ENABLED=0
- GO111MODULE=on
Expand All @@ -21,32 +18,61 @@ builds:
- openbsd
- netbsd
- solaris
# -plan9
- dragonfly
- windows
goarch:
- 386
- amd64
- arm
- arm64
# - ppc64
# - ppc64le
# - mips
# - mipsle
# - mips64
# - mips64le
goarm:
- 6
- 7
- main: ./main.go
id: "epoch-full" # Emedding tzdata and removing arm build (fails)
flags:
- -tags=timetzdata
env:
- CGO_ENABLED=0
- GO111MODULE=on
goos:
- linux
- darwin
- freebsd
- openbsd
- netbsd
- solaris
- dragonfly
- windows
goarch:
- 386
- amd64
- arm64


archives:
- wrap_in_directory: true
- id: epoch
builds:
- epoch
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip
files:
- LICENSE
- README.md
- id: epoch-full
builds:
- epoch-full
name_template: "{{ .ProjectName }}-full_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}"
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip
files:
- LICENSE
- README.md


checksum:
name_template: "checksums.txt"
Expand All @@ -62,10 +88,16 @@ nfpms:
formats:
- deb
- rpm
builds:
- epoch
dependencies:
- tzdata


brews:
- # name: dbbench
# folder: homebrew-tap
- name: epoch
ids:
- epoch
tap:
owner: sj14
name: homebrew-tap
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The functionallity is implemented as a package and can be used in other programs

### Precompiled Binaries

Binaries are available for all major platforms. See the [releases](https://github.com/sj14/epoch/releases) page.
Binaries are available for all major platforms. See the [releases](https://github.com/sj14/epoch/releases) page. Usually, `epoch` uses the timezone data from the operating system. When the operating system has no timezone data installed, you can use the 'full' binaries which have this information embedded.

### Homebrew

Expand Down
1 change: 0 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"strconv"
"strings"
"time"
_ "time/tzdata"

"github.com/sj14/epoch/epoch"
)
Expand Down

0 comments on commit 21194f8

Please sign in to comment.