2020-01-25 01:44:46 +01:00
|
|
|
title: Creating Releases using Webhooks
|
|
|
|
|
|
|
|
## What does this mean?
|
|
|
|
|
2020-01-25 03:30:42 +01:00
|
|
|
A webhook is a notification from one service to another. Put simply, a webhook
|
|
|
|
is used to notify ContentDB that the git repository has changed.
|
|
|
|
|
2020-01-25 01:44:46 +01:00
|
|
|
ContentDB offers the ability to automatically create releases using webhooks
|
|
|
|
from either Github or Gitlab. If you're not using either of those services,
|
|
|
|
you can also use the [API](../api) to create releases.
|
|
|
|
|
|
|
|
The process is as follows:
|
|
|
|
|
|
|
|
1. The user creates an API Token and a webhook to use it. This can be done automatically
|
|
|
|
for Github.
|
|
|
|
2. The user pushes a commit to the git host (Gitlab or Github).
|
|
|
|
3. The git host posts a webhook notification to ContentDB, using the API token assigned to it.
|
2020-01-25 03:30:42 +01:00
|
|
|
4. ContentDB checks the API token and issues a new release.
|
2020-01-25 01:44:46 +01:00
|
|
|
|
|
|
|
## Setting up
|
|
|
|
|
2020-01-30 22:39:51 +01:00
|
|
|
### GitHub (automatic)
|
2020-01-25 01:44:46 +01:00
|
|
|
|
2020-01-30 22:39:51 +01:00
|
|
|
1. Go to your package's page.
|
2020-01-25 01:44:46 +01:00
|
|
|
2. Make sure that the repository URL is set to a Github repository.
|
|
|
|
Only github.com is supported.
|
2020-01-30 22:39:51 +01:00
|
|
|
3. Go to "Releases" > "+", and click "Setup webhook" at the top of the create release
|
|
|
|
page.
|
2020-01-25 03:30:42 +01:00
|
|
|
If you do not see this, either the repository isn't using Github or you do
|
|
|
|
not have permission to use webhook releases (ie: you're not a Trusted Member).
|
|
|
|
4. Grant ContentDB the ability to manage Webhooks.
|
2020-01-30 22:39:51 +01:00
|
|
|
5. Set the event to either "New tag or Github Release" (highly recommended) or "Push".
|
2020-01-25 03:30:42 +01:00
|
|
|
|
|
|
|
N.B.: GitHub uses tags to power GitHub Releases, meaning that creating a webhook
|
2020-01-30 22:39:51 +01:00
|
|
|
on "New tag" will sync GitHub and ContentDB releases.
|
2020-01-25 01:44:46 +01:00
|
|
|
|
|
|
|
### GitHub (manual)
|
|
|
|
|
2020-06-03 17:41:06 +02:00
|
|
|
1. Create a ContentDB API Token at [Profile > API Tokens: Manage](/user/tokens/).
|
2020-01-25 01:44:46 +01:00
|
|
|
2. Copy the access token that was generated.
|
2020-06-03 17:32:39 +02:00
|
|
|
3. Go to the GitLab repository's settings > Webhooks > Add Webhook.
|
2020-01-25 01:44:46 +01:00
|
|
|
4. Set the payload URL to `https://content.minetest.net/github/webhook/`
|
|
|
|
5. Set the content type to JSON.
|
|
|
|
6. Set the secret to the access token that you copied.
|
|
|
|
7. Set the events
|
|
|
|
* If you want a rolling release, choose "just the push event".
|
|
|
|
* Or if you want a stable release cycle based on tags,
|
2020-01-30 22:39:51 +01:00
|
|
|
choose "Let me select" > Branch or tag creation.
|
2020-06-03 17:32:39 +02:00
|
|
|
8. Create.
|
2020-01-25 01:44:46 +01:00
|
|
|
|
|
|
|
### GitLab (manual)
|
|
|
|
|
2020-06-03 17:41:06 +02:00
|
|
|
1. Create a ContentDB API Token at [Profile > API Tokens: Manage](/user/tokens/).
|
2020-01-25 01:44:46 +01:00
|
|
|
2. Copy the access token that was generated.
|
2020-06-03 17:32:39 +02:00
|
|
|
3. Go to the GitLab repository's settings > Webhooks.
|
2020-01-25 01:44:46 +01:00
|
|
|
4. Set the URL to `https://content.minetest.net/gitlab/webhook/`
|
2020-06-03 17:32:39 +02:00
|
|
|
6. Set the secret token to the ContentDB access token that you copied.
|
2020-01-25 01:44:46 +01:00
|
|
|
7. Set the events
|
|
|
|
* If you want a rolling release, choose "Push events".
|
|
|
|
* Or if you want a stable release cycle based on tags,
|
|
|
|
choose "Tag push events".
|
2020-06-03 17:32:39 +02:00
|
|
|
8. Add webhook.
|
2020-01-25 01:44:46 +01:00
|
|
|
|
|
|
|
## Configuring
|
|
|
|
|
2020-09-17 00:32:24 +02:00
|
|
|
See the [Package Configuration and Releases Guide](/help/package_config/) for
|
|
|
|
documentation on configuring the release creation.
|
|
|
|
You can set the min/max Minetest version from the Git repository, and also
|
|
|
|
configure what files are included.
|