├── .github └── workflows │ └── build.yml ├── .goreleaser.yaml ├── Dockerfile ├── LICENSE.md ├── README.md ├── go.mod └── main.go /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | tags: 8 | - 'v*' 9 | pull_request: 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | with: 17 | fetch-depth: 0 18 | - uses: actions/setup-go@v2 19 | with: 20 | go-version: 1.19 21 | cache: true 22 | - run: go mod tidy 23 | - run: go test -v ./... 24 | - uses: docker/login-action@v1 25 | with: 26 | registry: ghcr.io 27 | username: ${{ github.repository_owner }} 28 | password: ${{ secrets.GH_PAT }} 29 | - uses: goreleaser/goreleaser-action@v2 30 | if: success() && startsWith(github.ref, 'refs/tags/') 31 | with: 32 | version: latest 33 | args: release --rm-dist 34 | env: 35 | GITHUB_TOKEN: ${{ secrets.GH_PAT }} 36 | -------------------------------------------------------------------------------- /.goreleaser.yaml: -------------------------------------------------------------------------------- 1 | project_name: example 2 | builds: 3 | - env: [CGO_ENABLED=0] 4 | goos: 5 | - linux 6 | - windows 7 | - darwin 8 | goarch: 9 | - amd64 10 | - arm64 11 | dockers: 12 | - image_templates: ["ghcr.io/goreleaser/example:{{ .Version }}"] 13 | dockerfile: Dockerfile 14 | build_flag_templates: 15 | - --label=org.opencontainers.image.title={{ .ProjectName }} 16 | - --label=org.opencontainers.image.description={{ .ProjectName }} 17 | - --label=org.opencontainers.image.url=https://github.com/goreleaser/example 18 | - --label=org.opencontainers.image.source=https://github.com/goreleaser/example 19 | - --label=org.opencontainers.image.version={{ .Version }} 20 | - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} 21 | - --label=org.opencontainers.image.revision={{ .FullCommit }} 22 | - --label=org.opencontainers.image.licenses=MIT 23 | nfpms: 24 | - maintainer: Carlos A Becker 25 | description: Sample project. 26 | homepage: https://github.com/caarlos0/tasktimer 27 | license: MIT 28 | formats: 29 | - deb 30 | - rpm 31 | - apk 32 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | COPY example /usr/bin/example 3 | ENTRYPOINT ["/usr/bin/example"] 4 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021-2022 Carlos Alexandro Becker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | GoReleaser example using GitHub. 4 | 5 | 6 | ![example release](https://user-images.githubusercontent.com/245435/190040286-ab966ac9-b7ba-46f8-8588-63753a09b640.mp4) 7 | 8 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/goreleaser/example 2 | 3 | go 1.19 4 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "runtime" 6 | ) 7 | 8 | var version = "dev" 9 | 10 | func main() { 11 | fmt.Println("hello world, github! (", version, runtime.GOOS, runtime.GOARCH, ")") 12 | } 13 | --------------------------------------------------------------------------------