You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use shipit you will need to specify a provider and a changeset.
41
+
42
+
A provider is a Git forge with supported APIs. A changeset is a list of file with the fields that need to be updated. You can specify multiple files in a changeset, each with their own templater (e.g. you can modify both a YAML and JSON file in a single call). shipit will *usually* perform all changes in a single commits but some APIs might only allow one file per commit so make sure to check the description for your provider.
43
+
44
+
Both provider and changeset are specified as JSON, either via command line or environment variable, like in the following table:
Every file specified in the changeset **MUST** exist.
55
+
56
+
### Using providers
57
+
58
+
#### Gitea / Forgejo
59
+
60
+
To use Gitea/Forgejo you will need to create an application, go to `<your-instance-url>/user/settings/applications` and generate a new token. Make sure to give it "repository: Read and Write" permissions, then use the following format for the provider parameter:
61
+
62
+
```json
63
+
{
64
+
"provider": "gitea",
65
+
"api_url": "https://<your-instance-url>/api/v1",
66
+
"project_id":"<username>/<repo_name>",
67
+
"token": "<username>:<token>"
68
+
}
69
+
```
70
+
71
+
#### GitLab
72
+
73
+
You will need to create an access token, either a project or account (project is probably better). You can find them at: `<your-instance-url>/<username>/<project-id>/-/settings/access_tokens`
74
+
75
+
The required scopes are `api, write_repository` and the role should be Maintainer, then use the following as your provider parameter:
76
+
77
+
```json
78
+
{
79
+
"provider": "gitea",
80
+
"api_url": "https://<your-instance-url>/api/v4",
81
+
"project_id":"<username>/<repo_name>",
82
+
"token": "<token>"
83
+
}
84
+
```
85
+
86
+
You can omit `api_url` if you are using Gitlab.com
87
+
27
88
### Using Templaters
28
89
90
+
Templaters are change operations that operate on a specific type of file, unlike providers you can specify as many templaters you want in a single call to shipit, for example:
The JSON templater replaces values within a JSON file. Keys are provided as strings using `/` for separation, you can specify array indexes for array (e.g. `nested/field/10/tag` becomes `nested.field[10].tag`).
103
+
104
+
Your changeset should look like this:
105
+
106
+
```json
107
+
[
108
+
{
109
+
"templater":"json",
110
+
"file":"/path/to/file.json",
111
+
"changes":{
112
+
"root-field":"new value",
113
+
"field/nested/0": "nested value"
114
+
}
115
+
}
116
+
]
117
+
```
118
+
119
+
The fields **MUST** exist in the file or the change will fail.
120
+
121
+
#### YAML
122
+
123
+
The YAML templater replaces values within a YAML file. Keys are provided as strings using `.` for separation, you can specify array indexes for array (e.g. `nested.field.10.tag` becomes `nested.field[10].tag`).
124
+
125
+
Your changeset should look like this:
126
+
127
+
```json
128
+
[
129
+
{
130
+
"templater":"yaml",
131
+
"file":"/path/to/file.json",
132
+
"changes":{
133
+
"root-field":"new value",
134
+
"field.nested.0": "nested value"
135
+
}
136
+
}
137
+
]
138
+
```
139
+
140
+
The fields **MUST** exist in the file or the change will fail.
141
+
29
142
#### Nix
30
143
31
144
The Nix templater replaces attributes within a Nix file. Arrays and other field types are not supported.
0 commit comments