1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

docs: cookbook for monorepos, release.tag

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker 2023-05-17 23:22:36 +00:00
parent 670238c3ea
commit 9fb855a204
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
4 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,65 @@
# Building in a private monorepo, publishing in to a public repository
One fairly common usecase is on open-core projects is to have the code in a
private monorepo, but publish its binaries to a public repository.
This cookbook gives some suggestions on how to handle that.
!!! success "GoReleaser Pro"
This cookbook uses [GoReleaser Pro](/pro).
Usually, you'll rely on tag prefixes for each sub-project within your monorepo.
GoReleaser can handle that within its [monorepo
configuration](/customization/monorepo):
```yaml
monorepo:
tag_prefix: app1/
dir: ./app1/
```
With that you can already push a tag `app1/v1.0.0`, for example, and GoReleaser
should gracefully handling everything.
But, if you want the release to happen in another repository, you'll also need
to add some [release](/customization/release) settings:
```yaml
release:
github:
owner: myorg
name: myrepo
```
When you release now, it'll create the `app1/v1.0.0` tag and respective release
in `myorg/myrepo`.
## Removing the `myapp/` prefix
Maybe you'll create one public repository to release each of the projects in
your monorepo. In that case, the tag prefix on the public repository makes no
sense.
You can remove it by setting the `release.tag` field:
```yaml
release:
tag: '{{ .Tag }}'
github:
owner: myorg
name: app1
```
!!! info
On GoReleaser Pro, `{{.Tag}}` is the tag without the prefix, and the
prefixed tag can be accessed with `{{.PrefixedTag}}`. Check the
[documentation](/customization/templates) for more information.
## Learning more
Make sure to take a look at the following documentation pages:
- [Monorepo](/customization/monorepo)
- [Release](/customization/release)
- [Template variables](/customization/templates)

View File

@ -48,8 +48,19 @@ release:
#
# Default: ''
# Since: v1.11
# Templates: allowed
target_commitish: '{{ .Commit }}'
# This allows to change which tag GitHub will create.
# Usually you'll use this together with `target_commitish`, or if you want to
# publish a binary from a monorepo into a public repository somewhere, without
# the tag prefix.
#
# Default: '{{ .PrefixedCurrentTag }}'
# Since: v1.19 (pro)
# Templates: allowed
tag: '{{ .CurrentTag }}'
# If set, will create a release discussion in the category specified.
#
# Warning: do not use categories in the 'Announcement' format.

3
www/docs/static/schema-pro.json generated vendored
View File

@ -2540,6 +2540,9 @@
"target_commitish": {
"type": "string"
},
"tag": {
"type": "string"
},
"disable": {
"oneOf": [
{

View File

@ -184,6 +184,7 @@ nav:
- About: cookbooks/index.md
- Blog Posts: cookbooks/blog-posts.md
- Add a new cookbook: cookbooks/contributing.md
- cookbooks/private-monorepo-public-release.md
- cookbooks/multi-platform-docker-images.md
- cookbooks/build-go-modules.md
- cookbooks/cgo-and-crosscompiling.md