Based on prettier/prettier
2.9 KiB
title |
---|
Artifactory |
Since 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:
artifactories:
- name: production
target: http://<Your-Instance>:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/
username: goreleaser
Prerequisites:
- A running Artifactory instances
- A user + password / API key with grants to upload an artifact
Target
The target
is the URL to upload the artifacts to (without the name of the artifact).
An example configuration for goreleaser
in upload mode binary
with the target can look like
http://artifacts.company.com:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/{{ .Os }}/{{ .Arch }}{{ if .Arm }}{{ .Arm }}{{ end }}
and 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:
- Version
- Tag
- ProjectName
- Os
- Arch
- Arm
Attention: Variables Os, Arch and Arm are only supported in upload mode binary
.
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.
The confgured name of your Artifactory instance will be used.
With this way we support auth for multiple instances.
This also means that the name
per configured instance needs to be unique
per goreleaser configuration.
The name of the environment variable will be ARTIFACTORY_NAME_SECRET
.
If your instance is named production
, you need to store the secret in the
environment variable ARTIFACTORY_PRODUCTION_SECRET
.
The name will be transformed to uppercase.
Customization
Of course, you can customize a lot of things:
# .goreleaser.yml
artifactories:
# You can have multiple Artifactory instances.
-
# Unique name of your artifactory instance. Used to identify the instance
name: production
# Upload mode. Valid options are `binary` and `archive`.
# If mode is `archive`, variables _Os_, _Arch_ and _Arm_ for target name are not supported.
# In that case these variables are empty.
# Default is `archive`.
mode: archive
# URL of your Artifactory instance + path to deploy to
target: http://artifacts.company.com:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/
# User that will be used for the deployment
username: deployuser
These settings should allow you to push your artifacts into multiple Artifactories.