1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/docs/160-artifactory.md

78 lines
2.2 KiB
Markdown
Raw Normal View History

---
title: Artifactory
---
Since [v0.38.0](https://github.com/goreleaser/goreleaser/releases/tag/v0.38.0),
GoReleaser supports building and pushing artifacts into Artifactory.
## How it works
You can declare multiple Artifactory instances.
All binaries generated by your `builds` section will be pushed to
each configured Artifactory.
If you have only one Artifactory instance,
the configuration is as easy as adding the
upload target and a usernameto your `.goreleaser.yml` file:
```yaml
artifactories:
- target: http://<Your-Instance>:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/{{ .Os }}/{{ .Arch }}{{ if .Arm }}{{ .Arm }}{{ end }}
username: goreleaser
```
Prerequisites:
- A running Artifactory instances
- A user + password / API key with grants to upload an artifact
### Target
The `target` is the final URL of _without_ the binary name.
A configuration for `goreleaser` with the target
```
http://artifacts.company.com:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/{{ .Os }}/{{ .Arch }}{{ if .Arm }}{{ .Arm }}{{ end }}
```
will result in a final deployment like
```
http://artifacts.company.com:8081/artifactory/example-repo-local/goreleaser/1.0.0/Darwin/x86_64/goreleaser
```
Support variables:
- Os
- Arch
- Arm
- Version
- Tag
- ProjectName
### Password / API Key
Your configured username needs to be authenticated against your Artifactory.
The password or API key will be stored in a environment variable.
If you have only one Artifactory configured, you will store the secret in `ARTIFACTORY_0_SECRET`.
If you have multiple instances configured, you store the password for the second instance in `ARTIFACTORY_1_SECRET`,
for the third in `ARTIFACTORY_2_SECRET` and so on.
## Customization
Of course, you can customize a lot of things:
```yaml
# .goreleaser.yml
artifactories:
# You can have multiple Artifactory instances.
-
# URL of your Artifactory instance + path to deploy to
target: http://artifacts.company.com:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/{{ .Os }}/{{ .Arch }}{{ if .Arm }}{{ .Arm }}{{ end }}
# User that will be used for the deployment
```
These settings should allow you to push your artifacts into multiple Artifactories.