1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-11-06 09:09:29 +02:00

docs: new docs with mkdocs (#1497)

* docs: new docs with mkdocs

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* docs: new docs with mkdocs

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* docs: new docs with mkdocs

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* docs: new docs with mkdocs

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* docs: new docs with mkdocs

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* docs: new docs with mkdocs

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* docs: new docs with mkdocs

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* docs: new docs with mkdocs

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: merge issues

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: merge issues

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: merge issues

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: package.json

for vercel/now deployment

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker
2020-05-10 16:57:11 -03:00
committed by GitHub
parent f7d0725418
commit 4c62e4c409
59 changed files with 743 additions and 620 deletions

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "www/themes/hugo-apex-theme"]
path = www/themes/hugo-apex-theme
url = https://github.com/caarlos0/hugo-apex-theme

View File

@@ -21,17 +21,6 @@ after_success:
- test -n "$TRAVIS_TAG" && openssl aes-256-cbc -K $encrypted_ee3523ecee9b_key -iv $encrypted_ee3523ecee9b_iv -in snap.login.enc -out snap.login -d
- test -n "$TRAVIS_TAG" && snapcraft login --with snap.login
deploy:
- deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
local_dir: www/public
target_branch: master
repo: goreleaser/goreleaser.github.io
verbose: true
fqdn: goreleaser.com
on:
tags: true
- provider: script
skip_cleanup: true
script: ./goreleaser

View File

@@ -8,7 +8,6 @@ export GOPROXY = https://proxy.golang.org,direct
# Install all the build and lint dependencies
setup:
curl -sfL https://install.goreleaser.com/github.com/gohugoio/hugo.sh | sh -s -- v0.63.2
go mod download
go generate -v ./...
.PHONY: setup
@@ -48,20 +47,15 @@ build:
go build
.PHONY: build
# Generate the static documentation
static:
@./bin/hugo --enableGitInfo --source www
.PHONY: static
imgs:
wget -O www/static/card.png "https://og.caarlos0.dev/**GoReleaser**%20%7C%20Deliver%20Go%20binaries%20as%20fast%20and%20easily%20as%20possible.png?theme=light&md=1&fontSize=80px&images=https://github.com/goreleaser.png"
wget -O www/static/avatar.png https://github.com/goreleaser.png
convert www/static/avatar.png -define icon:auto-resize=64,48,32,16 www/static/favicon.ico
convert www/static/avatar.png -resize x120 www/static/apple-touch-icon.png
wget -O docs/static/card.png "https://og.caarlos0.dev/**GoReleaser**%20%7C%20Deliver%20Go%20binaries%20as%20fast%20and%20easily%20as%20possible.png?theme=light&md=1&fontSize=80px&images=https://github.com/goreleaser.png"
wget -O docs/static/avatar.png https://github.com/goreleaser.png
convert docs/static/avatar.png -define icon:auto-resize=64,48,32,16 docs/static/favicon.ico
convert docs/static/avatar.png -resize x120 docs/static/apple-touch-icon.png
.PHONY: imgs
serve: imgs
@./bin/hugo server --enableGitInfo --watch --source www
@docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material
.PHONY: serve
# Show to-do items per file.

View File

@@ -48,8 +48,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
> **IMPORTANT**: note the `Unshallow` workflow step. It is required for the
> changelog to work correctly.
!!! info
Note the `Unshallow` workflow step. It is required for the changelog to work correctly.
### Run on new tag

25
docs/ci/circle.md Normal file
View File

@@ -0,0 +1,25 @@
# CircleCI
Here is how to do it with [CircleCI](https://circleci.com):
```yml
# .circleci/config.yml
version: 2.1
workflows:
main:
jobs:
- release:
# Only run this job on git tag pushes
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
jobs:
release:
docker:
- image: circleci/golang:1.14
steps:
- checkout
- run: curl -sL https://git.io/goreleaser | bash
```

67
docs/ci/cloudbuild.md Normal file
View File

@@ -0,0 +1,67 @@
# Google CloudBuild
CloudBuild works off a different clone than your GitHub repo: it seems that
your changes are pulled to a repo like
`source.developers.google.com/p/YourProjectId/r/github-YourGithubUser-YourGithubRepo`,
and that's what you're building off.
This repo has the wrong name, so to prevent GoReleaser from publishing to
the wrong GitHub repo, add to your `.goreleaser.yml` file's release section:
```yml
release:
github:
owner: YourGithubUser
name: YourGithubRepo
```
Create two build triggers:
- a "push to any branch" trigger for your regular CI (doesn't invoke GoReleaser)
- a "push to tag" trigger which invokes GoReleaser
The push to any branch trigger could use a `Dockerfile` or a `cloudbuild.yaml`,
whichever you prefer.
You should have a dedicated `cloudbuild.release.yaml` that is only used by the
"push to tag" trigger.
In this example we're creating a new release every time a new tag is pushed.
See [Using Encrypted Resources](https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-secrets-credentials)
for how to encrypt and base64-encode your github token.
The clone that the build uses
[has no tags](https://issuetracker.google.com/u/1/issues/113668706),
which is why we must explicitly run `git tag $TAG_NAME` (note that `$TAG_NAME`
is only set when your build is triggered by a "push to tag".)
This will allow GoReleaser to create a release with that version,
but it won't be able to build a proper
changelog containing just the messages from the commits since the prior tag.
Note that the build performs a shallow clone of git repositories and will
only contain tags that reference the latest commit.
```yml
steps:
# Setup the workspace so we have a viable place to point GOPATH at.
- name: gcr.io/cloud-builders/go
env: ['PROJECT_ROOT=github.com/YourGithubUser/YourGithubRepo']
args: ['env']
# Create github release.
- name: goreleaser/goreleaser
entrypoint: /bin/sh
dir: gopath/src/github.com
env: ['GOPATH=/workspace/gopath']
args: ['-c', 'cd YourGithubUser/YourGithubRepo && git tag $TAG_NAME && /goreleaser' ]
secretEnv: ['GITHUB_TOKEN']
secrets:
- kmsKeyName: projects/YourProjectId/locations/global/keyRings/YourKeyRing/cryptoKeys/YourKey
secretEnv:
GITHUB_TOKEN: |
ICAgICAgICBDaVFBZUhVdUVoRUtBdmZJSGxVWnJDZ0hOU2NtMG1ES0k4WjF3L04zT3pEazhRbDZr
QVVTVVFEM3dVYXU3cVJjK0g3T25UVW82YjJaCiAgICAgICAgREtBMWVNS0hOZzcyOUtmSGoyWk1x
ICAgICAgIEgwYndIaGUxR1E9PQo=
```

45
docs/ci/codefresh.md Normal file
View File

@@ -0,0 +1,45 @@
# Codefresh
Codefresh uses Docker based pipelines where all steps must be Docker containers.
Using GoReleaser is very easy via the
[existing Docker image](https://hub.docker.com/r/goreleaser/goreleaser/).
Here is an example pipeline that builds a Go application and then uses
GoReleaser.
```yaml
version: '1.0'
stages:
- prepare
- build
- release
steps:
main_clone:
title: 'Cloning main repository...'
type: git-clone
repo: '${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}'
revision: '${{CF_REVISION}}'
stage: prepare
BuildMyApp:
title: Compiling go code
stage: build
image: 'golang:1.14'
commands:
- go build
ReleaseMyApp:
title: Creating packages
stage: release
image: 'goreleaser/goreleaser'
commands:
- goreleaser --rm-dist
```
You need to pass the variable `GITHUB_TOKEN` in the Codefresh UI that
contains credentials to your Github account or load it from
[shared configuration](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/shared-configuration/).
You should also restrict this pipeline to run only on tags when you add
[git triggers](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/triggers/git-triggers/)
on it.
More details can be found in the
[GoReleaser example page](https://codefresh.io/docs/docs/learn-by-example/golang/goreleaser/).

70
docs/ci/drone.md Normal file
View File

@@ -0,0 +1,70 @@
# Drone
By default, drone does not fetch tags. `plugins/git` is used with default values,
in most cases we'll need overwrite the `clone` step enabling tags in order to make
`goreleaser` work correctly.
In this example we're creating a new release every time a new tag is pushed.
Note that you'll need to enable `tags` in repo settings and add `github_token`
secret.
#### 1.x
```yml
# .drone.yml
kind: pipeline
name: default
steps:
- name: fetch
image: docker:git
commands:
- git fetch --tags
- name: test
image: golang
volumes:
- name: deps
path: /go
commands:
- go test -race -v ./... -cover
- name: release
image: golang
environment:
GITHUB_TOKEN:
from_secret: github_token
volumes:
- name: deps
path: /go
commands:
- curl -sL https://git.io/goreleaser | bash
when:
event: tag
volumes:
- name: deps
temp: {}
```
#### 0.8
```yml
pipeline:
clone:
image: plugins/git
tags: true
test:
image: golang:1.10
commands:
- go test ./... -race
release:
image: golang:1.10
secrets: [github_token]
commands:
curl -sL https://git.io/goreleaser | bash
when:
event: tag
```

77
docs/ci/gitlab.md Normal file
View File

@@ -0,0 +1,77 @@
# GitLab CI
To create GitLab releases and push images to a Docker registry, add a file
`.gitlab-ci.yml` to the root of the project:
```yaml
stages:
- release
release:
stage: release
image: docker:stable
services:
- docker:dind
variables:
GORELEASER_IMAGE: goreleaser/goreleaser:latest
# Optionally use GitLab's built-in image registry.
# DOCKER_REGISTRY: $CI_REGISTRY
# DOCKER_USERNAME: $CI_REGISTRY_USER
# DOCKER_PASSWORD: $CI_REGISTRY_PASSWORD
# Or, use any registry, including the official one.
DOCKER_REGISTRY: https://index.docker.io/v1/
# Disable shallow cloning so that goreleaser can diff between tags to
# generate a changelog.
GIT_DEPTH: 0
# Only run this release job for tags, not every commit (for example).
only:
refs:
- tags
script: |
docker pull $GORELEASER_IMAGE
# GITLAB_TOKEN is needed to create GitLab releases.
# DOCKER_* are needed to push Docker images.
docker run --pull --rm --privileged \
-v $PWD:/go/src/gitlab.com/YourGitLabUser/YourGitLabRepo \
-w /go/src/gitlab.com/YourGitLabUser/YourGitLabRepo \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DOCKER_USERNAME -e DOCKER_PASSWORD -e DOCKER_REGISTRY \
-e GITLAB_TOKEN \
$GORELEASER_IMAGE release --rm-dist
```
In GitLab CI settings, add variables for `DOCKER_REGISTRY`, `DOCKER_USERNAME`,
and `DOCKER_PASSWORD` if you aren't using the GitLab image registry. If you are
using the GitLab image registry, you don't need to set these.
Add a variable `GITLAB_TOKEN` if you are using [GitLab
releases](https://docs.gitlab.com/ce/user/project/releases/). The value should
be an API token with `api` scope for a user that has access to the project.
The secret variables, `DOCKER_PASSWORD` and `GITLAB_TOKEN`, should be masked.
Optionally, you might want to protect them if the job that uses them will only
be run on protected branches or tags.
Make sure the `image_templates` in the file `.goreleaser.yml` reflect that
custom registry!
Example:
```yaml
dockers:
-
goos: linux
goarch: amd64
binaries:
- program
image_templates:
- 'registry.gitlab.com/Group/Project:{{ .Tag }}'
- 'registry.gitlab.com/Group/Project:latest'
```

6
docs/ci/index.md Normal file
View File

@@ -0,0 +1,6 @@
# Continuous Integration
GoReleaser was built from the very first commit with the idea of
running it as part of the CI pipeline in mind.
Let's see how we can get it working on popular CI software.

85
docs/ci/semaphore.md Normal file
View File

@@ -0,0 +1,85 @@
# Semaphore
In [Sempahore 2.0](https://semaphoreci.com) each project starts with the
default pipeline specified in `.semaphore/semaphore.yml`.
```yml
# .semaphore/semaphore.yml.
version: v1.0
name: Build
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
blocks:
- name: "Test"
task:
prologue:
commands:
# set go version
- sem-version go 1.11
- "export GOPATH=~/go"
- "export PATH=/home/semaphore/go/bin:$PATH"
- checkout
jobs:
- name: "Lint"
commands:
- go get ./...
- go test ./...
# On Semaphore 2.0 deployment and delivery is managed with promotions,
# which may be automatic or manual and optionally depend on conditions.
promotions:
- name: Release
pipeline_file: goreleaser.yml
auto_promote_on:
- result: passed
branch:
- "^refs/tags/v*"
```
Pipeline file in `.semaphore/goreleaser.yml`:
```yml
version: "v1.0"
name: GoReleaser
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
blocks:
- name: "Release"
task:
secrets:
- name: goreleaser
prologue:
commands:
- sem-version go 1.11
- "export GOPATH=~/go"
- "export PATH=/home/semaphore/go/bin:$PATH"
- checkout
jobs:
- name: goreleaser
commands:
- curl -sL https://git.io/goreleaser | bash
```
The following YAML file, `createSecret.yml` creates a new secret item that is
called GoReleaser with one environment variable, named `GITHUB_TOKEN`:
```yml
apiVersion: v1alpha
kind: Secret
metadata:
name: goreleaser
data:
env_vars:
- name: GITHUB_TOKEN
value: "4afk4388304hfhei34950dg43245"
```
Check [Managing Secrets](https://docs.semaphoreci.com/article/51-secrets-yaml-reference)
for more detailed documentation.

47
docs/ci/travis.md Normal file
View File

@@ -0,0 +1,47 @@
# Travis CI
You may want to setup your project to auto-deploy your new tags on
[Travis](https://travis-ci.org), for example:
```yaml
# .travis.yml
language: go
# needed only if you use the snap pipe:
addons:
apt:
packages:
- snapcraft
# needed only if you use the docker pipe
services:
- docker
script:
- go test ./... # replace this with your test script
- curl -sfL https://git.io/goreleaser | sh -s -- check # check goreleaser config for deprecations
after_success:
# docker login is required if you want to push docker images.
# DOCKER_PASSWORD should be a secret in your .travis.yml configuration.
- test -n "$TRAVIS_TAG" && docker login -u=myuser -p="$DOCKER_PASSWORD"
# snapcraft login is required if you want to push snapcraft packages to the
# store.
# You'll need to run `snapcraft export-login snap.login` and
# `travis encrypt-file snap.login --add` to add the key to the travis
# environment.
- test -n "$TRAVIS_TAG" && snapcraft login --with snap.login
# calls goreleaser
deploy:
- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash
on:
tags: true
condition: $TRAVIS_OS_NAME = linux
```
Note the last line (`condition: $TRAVIS_OS_NAME = linux`): it is important
if you run a build matrix with multiple Go versions and/or multiple OSes. If
that's the case you will want to make sure GoReleaser is run just once.

View File

@@ -1,8 +1,5 @@
---
title: Archive
series: customization
hideFromIndex: true
weight: 40
---
The binaries built will be archived together with the `README` and `LICENSE` files into a

View File

@@ -1,8 +1,5 @@
---
title: Artifactory
series: customization
hideFromIndex: true
weight: 120
---
Since [v0.38.0](https://github.com/goreleaser/goreleaser/releases/tag/v0.38.0),
@@ -52,8 +49,8 @@ Supported variables:
- Arch
- Arm
> **Attention**: Variables _Os_, _Arch_ and _Arm_ are only supported in upload
> mode `binary`.
!!! info
Variables _Os_, _Arch_ and _Arm_ are only supported in upload mode `binary`.
### Username

View File

@@ -1,8 +1,5 @@
---
title: Bintray
series: customization
hideFromIndex: true
weight: 120
---
## How it works

View File

@@ -1,8 +1,5 @@
---
title: Blob
series: customization
hideFromIndex: true
weight: 114
---
## Customization

View File

@@ -1,8 +1,5 @@
---
title: Builds
series: customization
hideFromIndex: true
weight: 30
---
Builds can be customized in multiple ways.
@@ -219,4 +216,4 @@ Environment variables are inherited and overridden in the following order:
GoReleaser uses `git describe` to get the build tag. You can set
a different build tag using the environment variable `GORELEASER_CURRENT_TAG`.
This is useful in scenarios where two tags point to the same commit.
This is useful in scenarios where two tags point to the same commit.

View File

@@ -1,8 +1,5 @@
---
title: Checksum
series: customization
hideFromIndex: true
weight: 50
---
GoReleaser generates a `project_1.0.0_checksums.txt` file and uploads it with the

View File

@@ -1,8 +1,5 @@
---
title: Docker
series: customization
hideFromIndex: true
weight: 140
---
Since [v0.31.0](https://github.com/goreleaser/goreleaser/releases/tag/v0.31.0),
@@ -35,9 +32,10 @@ ENTRYPOINT ["/mybin"]
This configuration will build and push a Docker image named `user/repo:tagname`.
> **Attention**: Note that were are not building any go files in the docker
> build phase, we are merely copying the binary to a `scratch` image and
> setting up the entrypoint.
!!! info
Note that were are not building any go files in the docker
build phase, we are merely copying the binary to a `scratch` image and
setting up the entrypoint.
## Customization

View File

@@ -1,8 +1,5 @@
---
title: Environment Variables
series: customization
hideFromIndex: true
weight: 19
---
Global environment variables to be passed down to all hooks and builds.

View File

@@ -1,8 +1,5 @@
---
title: Homebrew
series: customization
hideFromIndex: true
weight: 90
---
After releasing to GitHub or GitLab, GoReleaser can generate and publish a _homebrew-tap_

View File

@@ -1,8 +1,5 @@
---
title: Global Hooks
series: customization
hideFromIndex: true
weight: 20
---
Some builds may need pre-build steps before building, e.g. `go generate`.

View File

@@ -1,9 +1,4 @@
---
title: Customization
weight: 30
menu: true
layout: customizations
---
# Customization
GoReleaser provides multiple customizations via the `.goreleaser.yml` file.

View File

@@ -1,8 +1,5 @@
---
title: NFPM
series: customization
hideFromIndex: true
weight: 80
---
GoReleaser can be wired to [nfpm](https://github.com/goreleaser/nfpm) to

View File

@@ -1,8 +1,5 @@
---
title: Project Name
series: customization
hideFromIndex: true
weight: 10
---
The project name is used in the name of the Brew formula, archives, etc.

View File

@@ -1,8 +1,5 @@
---
title: Custom Publishers
series: customization
hideFromIndex: true
weight: 130
---
GoReleaser supports publishing artifacts by executing a custom publisher.

View File

@@ -1,8 +1,5 @@
---
title: Release
series: customization
hideFromIndex: true
weight: 110
---
GoReleaser will create a GitHub/GitLab release with the current tag, upload all

View File

@@ -1,8 +1,5 @@
---
title: Scoop
series: customization
hideFromIndex: true
weight: 100
---
After releasing to GitHub or GitLab, GoReleaser can generate and publish a

View File

@@ -1,8 +1,5 @@
---
title: Signing
series: customization
hideFromIndex: true
weight: 60
---
Signing ensures that the artifacts have been generated by yourself and your

View File

@@ -1,8 +1,5 @@
---
title: Snapcraft
series: customization
hideFromIndex: true
weight: 81
---
GoReleaser can also generate `snap` packages.

View File

@@ -1,8 +1,5 @@
---
title: Snapshots
series: customization
hideFromIndex: true
weight: 70
---
Sometimes we want to generate a full build of our project,

View File

@@ -1,8 +1,5 @@
---
title: Source Archive
series: customization
hideFromIndex: true
weight: 41
---
You may add the current tag source archive to the release as well. This is particularly

View File

@@ -1,8 +1,5 @@
---
title: Name Templates
series: customization
hideFromIndex: true
weight: 25
---
Several fields in GoReleaser's config file support templating.

View File

@@ -1,8 +1,5 @@
---
title: HTTP Upload
series: customization
hideFromIndex: true
weight: 120
---
GoReleaser supports building and pushing artifacts to HTTP servers using simple
@@ -52,7 +49,8 @@ Supported variables:
- Arch
- Arm
> **Warning**: Variables `Os`, `Arch` and `Arm` are only supported in upload mode `binary`.
!!! warning
Variables `Os`, `Arch` and `Arm` are only supported in upload mode `binary`.
For `archive` mode, it will also included the `LinuxPackage` type which is
generated by `nfpm` and the like.

View File

@@ -17,6 +17,8 @@ $ goreleaser check
## Active deprecation notices
None.
<!--
Template for new deprecations:

4
docs/index.md Normal file
View File

@@ -0,0 +1,4 @@
---
template: home.html
title: GoReleaser
---

View File

@@ -1,8 +1,4 @@
---
title: Install
weight: 2
menu: true
---
# Install
You can install the pre-compiled binary (in several different ways),
use Docker or compile from source.
@@ -69,8 +65,9 @@ $ docker run --rm --privileged \
goreleaser/goreleaser release
```
> **ATTENTION**: Currently, the provided docker image does not support
> the generation of snapcraft packages.
!!! info
Currently, the provided docker image does not support
the generation of snapcraft packages.
Note that the image will almost always have the last stable Go version.
@@ -84,7 +81,7 @@ and iterate from that.
[dockerfile]: https://github.com/goreleaser/goreleaser/blob/master/Dockerfile
[releases]: https://github.com/goreleaser/goreleaser/releases
## Compiling from source
### Compiling from source
Here you have two options:

140
docs/overrides/home.html Normal file
View File

@@ -0,0 +1,140 @@
{% extends "main.html" %}
{% block tabs %}
{{ super() }}
<style>
:root {
--goreleaser-primary-color: #3b5672;
}
.md-header {
position: initial
}
.md-main__inner {
margin: 0
}
.md-content {
display: none
}
.tx-container {
padding-top: 1rem;
background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1123 258'><path d='M1124,2c0,0 0,256 0,256l-1125,0l0,-48c0,0 16,5 55,5c116,0 197,-92 325,-92c121,0 114,46 254,46c140,0 214,-167 572,-166Z' style='fill: white' /></svg>") no-repeat bottom, linear-gradient(to bottom, var(--md-primary-fg-color), var(--goreleaser-primary-color) 99%, #fff 99%)
}
.tx-hero {
margin: 0 .8rem;
color: var(--md-primary-bg-color)
}
.tx-hero h1 {
margin-bottom: 1rem;
color: currentColor;
font-weight: 700
}
.tx-hero__content {
padding-bottom: 6rem
}
.tx-hero .md-button {
margin-top: .5rem;
margin-right: .5rem;
color: var(--md-primary-bg-color)
}
.tx-hero .md-button--primary {
background-color: var(--md-primary-bg-color);
color: var(--goreleaser-primary-color);
border-color: var(--md-primary-bg-color)
}
.tx-hero .md-button:focus,
.tx-hero .md-button:hover {
background-color: var(--md-accent-fg-color);
color: var(--md-default-bg-color);
border-color: var(--md-accent-fg-color)
}
@media screen and (max-width:70em) {
.tx-hero h1 {
font-size: 1.4rem
}
.tx-hero__image {
text-align: center;
}
.tx-hero__image img {
max-width: 10rem;
}
}
@media screen and (min-width:70em) {
.md-sidebar--secondary {
display: none
}
.tx-hero {
display: flex;
align-items: stretch
}
.tx-hero__content {
max-width: 30rem;
margin-top: 3.5rem;
padding-bottom: 14vw
}
.tx-hero__image {
order: 1;
margin-left: auto;
margin-top: 3.5rem;
}
.tx-hero__image img {
max-width: 15rem;
}
}
@media screen and (min-width:76.25em) {
.md-sidebar--primary {
display: none
}
.tx-hero__image {
margin-left: auto;
}
.tx-hero__image img {
max-width: 20rem;
}
}
</style>
<section class="tx-container">
<div class="md-grid md-typeset">
<div class="tx-hero">
<div class="tx-hero__image">
<img src="https://github.com/goreleaser/artwork/raw/master/goreleaserfundo.png" alt=""
draggable="false">
</div>
<div class="tx-hero__content">
<h1>GoReleaser is a release automation tool for Go projects.</h1>
<p>The goal is to simplify the build, release and publish steps while providing variant customization
options for all steps.</p>
<a href="{{ page.next_page.url | url }}" title="{{ page.next_page.title | striptags }}"
class="md-button md-button--primary">
Get started
</a>
<a href="{{ config.repo_url }}" title="{{ lang.t('source.link.title') }}" class="md-button">
Go to GitHub
</a>
</div>
</div>
</div>
</section>
{% endblock %}
{% block content %}{% endblock %}
{% block footer %}{% endblock %}

52
docs/overrides/main.html Normal file
View File

@@ -0,0 +1,52 @@
{% extends "base.html" %}
{% block extrahead %}
{% set title = config.site_name %}
{% if page and page.title and not page.is_homepage %}
{% set title = config.site_name ~ " - " ~ page.title | striptags %}
{% endif %}
{% set image = config.site_url ~ 'static/card.png' %}
<meta property="og:type" content="website">
<meta property="og:title" content="{{ title }}">
<meta property="og:description" content="{{ config.site_description }}">
<meta property="og:url" content="{{ page.canonical_url }}">
<meta property="og:image" content="{{ image }}">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@goreleaser">
<meta name="twitter:creator" content="@goreleaser">
<meta name="twitter:title" content="{{ title }}">
<meta name="twitter:description" content="{{ config.site_description }}">
<meta name="twitter:image" content="{{ image }}">
{% endblock %}
{% block announce %}
<style>
.md-announce a,
.md-announce a:focus,
.md-announce a:hover {
color: currentColor
}
.md-announce strong {
white-space: nowrap
}
.md-announce .twitter {
margin-left: .2em;
color: #00acee
}
</style>
<a href="https://twitter.com/goreleaser">
For updates follow <strong>@goreleaser</strong> on
<span class="twemoji twitter">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<path
d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z">
</path>
</svg>
</span>
<strong>Twitter</strong>
</a>
{% endblock %}

View File

@@ -1,8 +1,4 @@
---
title: Quick Start
weight: 10
menu: true
---
# Quick Start
In this example we will build, archive and release a sample Go project.
@@ -70,7 +66,8 @@ $ git tag -a v0.1.0 -m "First release"
$ git push origin v0.1.0
```
> **Attention**: Check if your tag adheres to [semantic versioning](/semver).
!!! info
Check if your tag adheres to [semantic versioning](/semver).
If you don't want to create a tag yet, you can also run GoReleaser without publishing
based on the latest commit by using the `--snapshot` flag:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

87
mkdocs.yml Normal file
View File

@@ -0,0 +1,87 @@
site_name: GoReleaser
site_description: Deliver Go binaries as fast and easily as possible
copyright: Made with ❤️ by GoReleaser contributors.
repo_name: goreleaser/goreleaser
repo_url: https://github.com/goreleaser/goreleaser
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/goreleaser
- icon: fontawesome/brands/twitter
link: https://twitter.com/goreleaser
theme:
name: material
custom_dir: docs/overrides
features:
- instant
# - tabs
language: en
logo: static/avatar.png
favicon: static/favicon.icon
plugins:
- search
- git-revision-date-localized:
type: date
extra:
version: v0.140.0
google_analytics:
- UA-106198408-1
- auto
nav:
- Home: index.md
- install.md
- quick-start.md
- environment.md
- Limitations:
- limitations/semver.md
- limitations/cgo.md
- Continuous Integration:
- About: ci/index.md
- ci/actions.md
- ci/travis.md
- ci/gitlab.md
- ci/circle.md
- ci/cloudbuild.md
- ci/codefresh.md
- ci/drone.md
- ci/semaphore.md
- Customization:
- About: customization/index.md
- customization/project.md
- customization/env.md
- customization/hooks.md
- customization/templates.md
- customization/build.md
- customization/archive.md
- customization/source.md
- customization/checksum.md
- customization/sign.md
- customization/snapshots.md
- customization/nfpm.md
- customization/snapcraft.md
- customization/release.md
- customization/homebrew.md
- customization/scoop.md
- customization/docker.md
- customization/blob.md
- customization/artifactory.md
- customization/bintray.md
- customization/upload.md
- customization/publishers.md
- deprecations.md
- sponsors.md
- contributing.md
- tutorials.md
- links.md
markdown_extensions:
- admonition
- codehilite
- meta
- toc:
permalink: true

11
package.json Normal file
View File

@@ -0,0 +1,11 @@
{
"name": "goreleaser-docs",
"version": "1.0.0",
"description": "goreleaser documentation",
"author": "goreleaser",
"license": "MIT",
"scripts": {
"start": "docker run --rm -it -p 8000:8000 -v `pwd`:/docs squidfunk/mkdocs-material",
"build": "rm -rf site && docker run --rm -it -v `pwd`:/docs squidfunk/mkdocs-material build"
}
}

1
www/.gitignore vendored
View File

@@ -1 +0,0 @@
public/

View File

@@ -1,15 +0,0 @@
baseURL = "https://goreleaser.com/"
languageCode = "en-us"
title = "GoReleaser"
copyright = "Made with ❤️ by GoReleaser contributors."
googleAnalytics = "UA-106198408-1"
theme = "hugo-apex-theme"
pygmentsCodeFences = true
pygmentsStyle = "dracula"
[params]
name = "GoReleaser"
description = "Deliver Go binaries as fast and easily as possible"
twitter = "goreleaser"
logo = "https://github.com/goreleaser.png"
ghdocsrepo = "https://github.com/goreleaser/goreleaser/edit/master/www"

View File

@@ -1,430 +0,0 @@
---
title: Continuous Integration
menu: true
weight: 140
---
GoReleaser was built from the very first commit with the idea of
running it as part of the CI pipeline in mind.
Let's see how we can get it working on popular CI software.
## Travis CI
You may want to setup your project to auto-deploy your new tags on
[Travis](https://travis-ci.org), for example:
```yaml
# .travis.yml
language: go
# needed only if you use the snap pipe:
addons:
apt:
packages:
- snapcraft
# needed only if you use the docker pipe
services:
- docker
script:
- go test ./... # replace this with your test script
- curl -sfL https://git.io/goreleaser | sh -s -- check # check goreleaser config for deprecations
after_success:
# docker login is required if you want to push docker images.
# DOCKER_PASSWORD should be a secret in your .travis.yml configuration.
- test -n "$TRAVIS_TAG" && docker login -u=myuser -p="$DOCKER_PASSWORD"
# snapcraft login is required if you want to push snapcraft packages to the
# store.
# You'll need to run `snapcraft export-login snap.login` and
# `travis encrypt-file snap.login --add` to add the key to the travis
# environment.
- test -n "$TRAVIS_TAG" && snapcraft login --with snap.login
# calls goreleaser
deploy:
- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash
on:
tags: true
condition: $TRAVIS_OS_NAME = linux
```
Note the last line (`condition: $TRAVIS_OS_NAME = linux`): it is important
if you run a build matrix with multiple Go versions and/or multiple OSes. If
that's the case you will want to make sure GoReleaser is run just once.
## CircleCI
Here is how to do it with [CircleCI](https://circleci.com):
```yml
# .circleci/config.yml
version: 2.1
workflows:
main:
jobs:
- release:
# Only run this job on git tag pushes
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
jobs:
release:
docker:
- image: circleci/golang:1.14
steps:
- checkout
- run: curl -sL https://git.io/goreleaser | bash
```
## Drone
By default, drone does not fetch tags. `plugins/git` is used with default values,
in most cases we'll need overwrite the `clone` step enabling tags in order to make
`goreleaser` work correctly.
In this example we're creating a new release every time a new tag is pushed.
Note that you'll need to enable `tags` in repo settings and add `github_token`
secret.
#### 1.x
```yml
# .drone.yml
kind: pipeline
name: default
steps:
- name: fetch
image: docker:git
commands:
- git fetch --tags
- name: test
image: golang
volumes:
- name: deps
path: /go
commands:
- go test -race -v ./... -cover
- name: release
image: golang
environment:
GITHUB_TOKEN:
from_secret: github_token
volumes:
- name: deps
path: /go
commands:
- curl -sL https://git.io/goreleaser | bash
when:
event: tag
volumes:
- name: deps
temp: {}
```
#### 0.8
```yml
pipeline:
clone:
image: plugins/git
tags: true
test:
image: golang:1.10
commands:
- go test ./... -race
release:
image: golang:1.10
secrets: [github_token]
commands:
curl -sL https://git.io/goreleaser | bash
when:
event: tag
```
## Google CloudBuild
CloudBuild works off a different clone than your GitHub repo: it seems that
your changes are pulled to a repo like
`source.developers.google.com/p/YourProjectId/r/github-YourGithubUser-YourGithubRepo`,
and that's what you're building off.
This repo has the wrong name, so to prevent GoReleaser from publishing to
the wrong GitHub repo, add to your `.goreleaser.yml` file's release section:
```yml
release:
github:
owner: YourGithubUser
name: YourGithubRepo
```
Create two build triggers:
- a "push to any branch" trigger for your regular CI (doesn't invoke GoReleaser)
- a "push to tag" trigger which invokes GoReleaser
The push to any branch trigger could use a `Dockerfile` or a `cloudbuild.yaml`,
whichever you prefer.
You should have a dedicated `cloudbuild.release.yaml` that is only used by the
"push to tag" trigger.
In this example we're creating a new release every time a new tag is pushed.
See [Using Encrypted Resources](https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-secrets-credentials)
for how to encrypt and base64-encode your github token.
The clone that the build uses
[has no tags](https://issuetracker.google.com/u/1/issues/113668706),
which is why we must explicitly run `git tag $TAG_NAME` (note that `$TAG_NAME`
is only set when your build is triggered by a "push to tag".)
This will allow GoReleaser to create a release with that version,
but it won't be able to build a proper
changelog containing just the messages from the commits since the prior tag.
Note that the build performs a shallow clone of git repositories and will
only contain tags that reference the latest commit.
```yml
steps:
# Setup the workspace so we have a viable place to point GOPATH at.
- name: gcr.io/cloud-builders/go
env: ['PROJECT_ROOT=github.com/YourGithubUser/YourGithubRepo']
args: ['env']
# Create github release.
- name: goreleaser/goreleaser
entrypoint: /bin/sh
dir: gopath/src/github.com
env: ['GOPATH=/workspace/gopath']
args: ['-c', 'cd YourGithubUser/YourGithubRepo && git tag $TAG_NAME && /goreleaser' ]
secretEnv: ['GITHUB_TOKEN']
secrets:
- kmsKeyName: projects/YourProjectId/locations/global/keyRings/YourKeyRing/cryptoKeys/YourKey
secretEnv:
GITHUB_TOKEN: |
ICAgICAgICBDaVFBZUhVdUVoRUtBdmZJSGxVWnJDZ0hOU2NtMG1ES0k4WjF3L04zT3pEazhRbDZr
QVVTVVFEM3dVYXU3cVJjK0g3T25UVW82YjJaCiAgICAgICAgREtBMWVNS0hOZzcyOUtmSGoyWk1x
ICAgICAgIEgwYndIaGUxR1E9PQo=
```
## Semaphore
In [Sempahore 2.0](https://semaphoreci.com) each project starts with the
default pipeline specified in `.semaphore/semaphore.yml`.
```yml
# .semaphore/semaphore.yml.
version: v1.0
name: Build
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
blocks:
- name: "Test"
task:
prologue:
commands:
# set go version
- sem-version go 1.11
- "export GOPATH=~/go"
- "export PATH=/home/semaphore/go/bin:$PATH"
- checkout
jobs:
- name: "Lint"
commands:
- go get ./...
- go test ./...
# On Semaphore 2.0 deployment and delivery is managed with promotions,
# which may be automatic or manual and optionally depend on conditions.
promotions:
- name: Release
pipeline_file: goreleaser.yml
auto_promote_on:
- result: passed
branch:
- "^refs/tags/v*"
```
Pipeline file in `.semaphore/goreleaser.yml`:
```yml
version: "v1.0"
name: GoReleaser
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
blocks:
- name: "Release"
task:
secrets:
- name: goreleaser
prologue:
commands:
- sem-version go 1.11
- "export GOPATH=~/go"
- "export PATH=/home/semaphore/go/bin:$PATH"
- checkout
jobs:
- name: goreleaser
commands:
- curl -sL https://git.io/goreleaser | bash
```
The following YAML file, `createSecret.yml` creates a new secret item that is
called GoReleaser with one environment variable, named `GITHUB_TOKEN`:
```yml
apiVersion: v1alpha
kind: Secret
metadata:
name: goreleaser
data:
env_vars:
- name: GITHUB_TOKEN
value: "4afk4388304hfhei34950dg43245"
```
Check [Managing Secrets](https://docs.semaphoreci.com/article/51-secrets-yaml-reference)
for more detailed documentation.
## GitLab CI
To create GitLab releases and push images to a Docker registry, add a file
`.gitlab-ci.yml` to the root of the project:
```yaml
stages:
- release
release:
stage: release
image: docker:stable
services:
- docker:dind
variables:
GORELEASER_IMAGE: goreleaser/goreleaser:latest
# Optionally use GitLab's built-in image registry.
# DOCKER_REGISTRY: $CI_REGISTRY
# DOCKER_USERNAME: $CI_REGISTRY_USER
# DOCKER_PASSWORD: $CI_REGISTRY_PASSWORD
# Or, use any registry, including the official one.
DOCKER_REGISTRY: https://index.docker.io/v1/
# Disable shallow cloning so that goreleaser can diff between tags to
# generate a changelog.
GIT_DEPTH: 0
# Only run this release job for tags, not every commit (for example).
only:
refs:
- tags
script: |
docker pull $GORELEASER_IMAGE
# GITLAB_TOKEN is needed to create GitLab releases.
# DOCKER_* are needed to push Docker images.
docker run --pull --rm --privileged \
-v $PWD:/go/src/gitlab.com/YourGitLabUser/YourGitLabRepo \
-w /go/src/gitlab.com/YourGitLabUser/YourGitLabRepo \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DOCKER_USERNAME -e DOCKER_PASSWORD -e DOCKER_REGISTRY \
-e GITLAB_TOKEN \
$GORELEASER_IMAGE release --rm-dist
```
In GitLab CI settings, add variables for `DOCKER_REGISTRY`, `DOCKER_USERNAME`,
and `DOCKER_PASSWORD` if you aren't using the GitLab image registry. If you are
using the GitLab image registry, you don't need to set these.
Add a variable `GITLAB_TOKEN` if you are using [GitLab
releases](https://docs.gitlab.com/ce/user/project/releases/). The value should
be an API token with `api` scope for a user that has access to the project.
The secret variables, `DOCKER_PASSWORD` and `GITLAB_TOKEN`, should be masked.
Optionally, you might want to protect them if the job that uses them will only
be run on protected branches or tags.
Make sure the `image_templates` in the file `.goreleaser.yml` reflect that
custom registry!
Example:
```yaml
dockers:
-
goos: linux
goarch: amd64
binaries:
- program
image_templates:
- 'registry.gitlab.com/Group/Project:{{ .Tag }}'
- 'registry.gitlab.com/Group/Project:latest'
```
## Codefresh
Codefresh uses Docker based pipelines where all steps must be Docker containers.
Using GoReleaser is very easy via the
[existing Docker image](https://hub.docker.com/r/goreleaser/goreleaser/).
Here is an example pipeline that builds a Go application and then uses
GoReleaser.
```yaml
version: '1.0'
stages:
- prepare
- build
- release
steps:
main_clone:
title: 'Cloning main repository...'
type: git-clone
repo: '${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}'
revision: '${{CF_REVISION}}'
stage: prepare
BuildMyApp:
title: Compiling go code
stage: build
image: 'golang:1.14'
commands:
- go build
ReleaseMyApp:
title: Creating packages
stage: release
image: 'goreleaser/goreleaser'
commands:
- goreleaser --rm-dist
```
You need to pass the variable `GITHUB_TOKEN` in the Codefresh UI that
contains credentials to your Github account or load it from
[shared configuration](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/shared-configuration/).
You should also restrict this pipeline to run only on tags when you add
[git triggers](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/triggers/git-triggers/)
on it.
More details can be found in the
[GoReleaser example page](https://codefresh.io/docs/docs/learn-by-example/golang/goreleaser/).

View File

@@ -1,34 +0,0 @@
---
title: Introduction
weight: 1
menu: true
---
[GoReleaser](https://github.com/goreleaser/goreleaser) is a release automation
tool for Go projects. The goal is to simplify the build, release and
publish steps while providing variant customization options for all steps.
GoReleaser is built for CI tools; you only need to
[download and execute it](/ci) in your build script.
Of course, you can also [install it locally](/install) if you wish.
You can also [customize](/customization) your release process through a
`.goreleaser.yml` file.
<span id="count" title="value get with goreleaser/func">Several</span>
GitHub projects trust their release process to GoReleaser.
<script>
var req = new XMLHttpRequest();
req.open("GET", "https://func.goreleaser.now.sh");
req.onload = function() {
document.querySelector("#count").textContent = req.response
}
req.send();
</script>
<style>
#count {
font-weight: bold;
}
</style>

1
www/data/.gitignore vendored
View File

@@ -1 +0,0 @@
projects/*.yaml

View File

@@ -1,21 +0,0 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ .Content }}
<h2>Table of Contents:</h2>
<ul class="Menu" style="padding: 0px; position: inherit; margin: 15px 0 0px 20px;">
{{ range where .Site.Pages.ByWeight "Params.series" "customization" }}
<li class="item" style="padding: 0px">
<a href="#{{ .Title }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
{{ range where .Site.Pages.ByWeight "Params.series" "customization" }}
<div class="Page" id="{{ .Title }}">
<h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
{{ .Content }}
</div>
{{ end }}
{{ end }}