.gitignore | ||
go.mod | ||
go.sum | ||
main.go | ||
README.md | ||
template.yml |
drone-add
Easily add Drone.io to projects using Drone APIs and YAML templates.
Getting started
Install drone-add
go get -u git.fromouter.space/Hamcha/drone-add
or, if you have cloned the project locally, just cd
to it and:
go install .
Set environment variables
To authenticate with Drone you'll need to get your user token.
If you have the drone
CLI tool, the environment variables are the same (DRONE_SERVER
/ DRONE_TOKEN
).
If you have drone secret you want to add, set them as environment variables using this format:
DRONE_SECRET_SECRET_NAME
→ secret_name
You can use template literals in your secrets, for example:
DRONE_SECRET_DOCKER_REPO = "my-custom-registry.tld/{{.Namespace}}/{{.Name}}"
with project testorg/my-repo
will create a secret called docker_repo
with value my-custom-registry.tld/testorg/my-repo
Change the template
If you have not downloaded the project locally, download the template file from here.
Change the template to fit what a starting .drone.yml
for your projects would be like.
Usually this means just populating common steps (like publish and deployment steps).
You can also use template literals in the template.
Run the tool
Usage:
drone-add [-t template.yml] [-o .drone.yml] namespace/repository
Templating powered by Sprig
Need more control? You can use sprig functions in your templated code!