@sentry/craft 2.13.1 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -236,13 +236,56 @@ that CI triggered by pushing this branch will result in release artifacts
236
236
  being built and uploaded to the artifact provider you wish to use during the
237
237
  subsequent `publish` step.
238
238
 
239
+ **Version Specification**
240
+
241
+ The `NEW-VERSION` argument can be specified in three ways:
242
+
243
+ 1. **Explicit version** (e.g., `1.2.3`): Release with the specified version
244
+ 2. **Bump type** (`major`, `minor`, or `patch`): Automatically increment the latest tag
245
+ 3. **Auto** (`auto`): Analyze commits since the last tag and determine bump type from conventional commit patterns
246
+
247
+ The bump type and auto options require `minVersion: '2.14.0'` or higher in `.craft.yml`.
248
+
249
+ **Auto-versioning Details**
250
+
251
+ When using `auto`, craft analyzes commits since the last tag and matches them against
252
+ categories in `.github/release.yml` (or the default conventional commits config).
253
+ Each category can have a `semver` field (`major`, `minor`, or `patch`) that determines
254
+ the version bump. The highest bump type across all matched commits is used:
255
+
256
+ - Breaking changes (e.g., `feat!:`, `fix!:`) trigger a **major** bump
257
+ - New features (`feat:`) trigger a **minor** bump
258
+ - Bug fixes, docs, chores trigger a **patch** bump
259
+
260
+ Example `.github/release.yml` with semver fields:
261
+
262
+ ```yaml
263
+ changelog:
264
+ categories:
265
+ - title: Breaking Changes
266
+ commit_patterns:
267
+ - '^\w+(\(\w+\))?!:'
268
+ semver: major
269
+ - title: Features
270
+ commit_patterns:
271
+ - '^feat(\(\w+\))?:'
272
+ semver: minor
273
+ - title: Bug Fixes
274
+ commit_patterns:
275
+ - '^fix(\(\w+\))?:'
276
+ semver: patch
277
+ ```
278
+
239
279
  ```shell
240
280
  craft prepare NEW-VERSION
241
281
 
242
282
  🚢 Prepare a new release branch
243
283
 
244
284
  Positionals:
245
- NEW-VERSION The new version you want to release [string] [required]
285
+ NEW-VERSION The new version to release. Can be: a semver string (e.g.,
286
+ "1.2.3"), a bump type ("major", "minor", or "patch"), or "auto"
287
+ to determine automatically from conventional commits.
288
+ [string] [required]
246
289
 
247
290
  Options:
248
291
  --no-input Suppresses all user prompts [default: false]
@@ -1064,44 +1107,199 @@ targets:
1064
1107
  ### Docker (`docker`)
1065
1108
 
1066
1109
  Copies an existing source image tagged with the revision SHA to a new target
1067
- tagged with the released version. No release assets are required for this target
1068
- except for the source image at the provided source image location so it would be
1069
- a good idea to add a status check that ensures the source image exists, otherwise
1070
- `craft publish` will fail at the copy step, causing an interrupted publish.
1071
- This is an issue for other, non-idempotent targets, not for the Docker target.
1110
+ tagged with the released version. Supports multiple registries including Docker Hub,
1111
+ GitHub Container Registry (ghcr.io), Google Container Registry (gcr.io), and other
1112
+ OCI-compliant registries.
1113
+
1114
+ No release assets are required for this target except for the source image at the
1115
+ provided source image location so it would be a good idea to add a status check
1116
+ that ensures the source image exists, otherwise `craft publish` will fail at the
1117
+ copy step, causing an interrupted publish. This is an issue for other, non-idempotent
1118
+ targets, not for the Docker target.
1072
1119
 
1073
1120
  **Environment**
1074
1121
 
1075
1122
  `docker` executable (or something equivalent) with BuildKit must be installed on the system.
1076
1123
 
1077
- | Name | Description |
1078
- | ----------------- | ------------------------------------------ |
1079
- | `DOCKER_USERNAME` | The username for the Docker registry. |
1080
- | `DOCKER_PASSWORD` | The personal access token for the account. |
1081
- | `DOCKER_BIN` | **optional**. Path to `docker` executable. |
1124
+ **Target Registry Credentials** are resolved in the following order:
1125
+
1126
+ 1. **Explicit env var override**: If `usernameVar` and `passwordVar` are configured,
1127
+ only those environment variables are used (no fallback).
1128
+ 2. **Registry-derived env vars**: Based on the target registry, e.g., `DOCKER_GHCR_IO_USERNAME`
1129
+ and `DOCKER_GHCR_IO_PASSWORD` for `ghcr.io`.
1130
+ 3. **Built-in defaults**: For `ghcr.io`, uses `GITHUB_ACTOR` and `GITHUB_TOKEN` which are
1131
+ automatically available in GitHub Actions.
1132
+ 4. **Default**: `DOCKER_USERNAME` and `DOCKER_PASSWORD`.
1133
+
1134
+ **Source Registry Credentials** (for cross-registry publishing) are resolved similarly but
1135
+ without falling back to `DOCKER_USERNAME`/`DOCKER_PASSWORD`. If the source registry differs
1136
+ from the target and requires authentication, set `DOCKER_<SOURCE_REGISTRY>_USERNAME/PASSWORD`
1137
+ or use `sourceUsernameVar`/`sourcePasswordVar`. If no source credentials are found, the
1138
+ source is assumed to be public.
1139
+
1140
+ | Name | Description |
1141
+ | ------------------------------- | ----------------------------------------------------------------------------------------- |
1142
+ | `DOCKER_USERNAME` | Default username for target Docker registry. |
1143
+ | `DOCKER_PASSWORD` | Default password/token for target Docker registry. |
1144
+ | `DOCKER_<REGISTRY>_USERNAME` | Registry-specific username (e.g., `DOCKER_GHCR_IO_USERNAME` for `ghcr.io`). |
1145
+ | `DOCKER_<REGISTRY>_PASSWORD` | Registry-specific password (e.g., `DOCKER_GHCR_IO_PASSWORD` for `ghcr.io`). |
1146
+ | `GITHUB_ACTOR` | Used as default username for `ghcr.io` (available in GitHub Actions). |
1147
+ | `GITHUB_TOKEN` | Used as default password for `ghcr.io` (available in GitHub Actions). |
1148
+ | `DOCKER_BIN` | **optional**. Path to `docker` executable. |
1082
1149
 
1083
1150
  **Configuration**
1084
1151
 
1085
- | Option | Description |
1086
- | -------------- | ------------------------------------------------------------------------ |
1087
- | `source` | Path to the source Docker image to be pulled |
1088
- | `sourceFormat` | Format for the source image name. Default: `{{{source}}}:{{{revision}}}` |
1089
- | `target` | Path to the target Docker image to be pushed |
1090
- | `targetFormat` | Format for the target image name. Default: `{{{target}}}:{{{version}}}` |
1152
+ Both `source` and `target` can be specified as a string (image path) or an object with additional options:
1091
1153
 
1092
- **Example**
1154
+ | Option | Description |
1155
+ | -------- | --------------------------------------------------------------------------------- |
1156
+ | `source` | Source image: string `"ghcr.io/org/image"` or object (see below) |
1157
+ | `target` | Target image: string `"getsentry/craft"` or object (see below) |
1158
+
1159
+ When `source` or `target` is an object:
1160
+
1161
+ | Property | Description |
1162
+ | ------------- | -------------------------------------------------------------------------- |
1163
+ | `image` | Docker image path (e.g., `ghcr.io/org/image`) |
1164
+ | `registry` | **optional**. Override the registry (auto-detected from `image`) |
1165
+ | `format` | **optional**. Format template. Default: `{{{source}}}:{{{revision}}}` for source, `{{{target}}}:{{{version}}}` for target |
1166
+ | `usernameVar` | **optional**. Env var name for username (must be used with `passwordVar`) |
1167
+ | `passwordVar` | **optional**. Env var name for password (must be used with `usernameVar`) |
1168
+ | `skipLogin` | **optional**. Skip `docker login` for this registry. Use when auth is configured externally (e.g., gcloud workload identity). |
1169
+
1170
+ **Legacy options** (for backwards compatibility, prefer object format above):
1171
+
1172
+ | Option | Description |
1173
+ | ------------------- | --------------------------------------------------------------------------------- |
1174
+ | `sourceFormat` | Format for the source image name (use `source.format` instead) |
1175
+ | `sourceRegistry` | Override the source registry (use `source.registry` instead) |
1176
+ | `sourceUsernameVar` | Env var name for source username (use `source.usernameVar` instead) |
1177
+ | `sourcePasswordVar` | Env var name for source password (use `source.passwordVar` instead) |
1178
+ | `targetFormat` | Format for the target image name (use `target.format` instead) |
1179
+ | `registry` | Override the target registry (use `target.registry` instead) |
1180
+ | `usernameVar` | Env var name for target username (use `target.usernameVar` instead) |
1181
+ | `passwordVar` | Env var name for target password (use `target.passwordVar` instead) |
1182
+ | `skipLogin` | Skip login for target registry (use `target.skipLogin` instead) |
1183
+ | `sourceSkipLogin` | Skip login for source registry (use `source.skipLogin` instead) |
1184
+
1185
+ **Examples**
1186
+
1187
+ Publishing to Docker Hub (default):
1093
1188
 
1094
1189
  ```yaml
1095
1190
  targets:
1096
1191
  - name: docker
1097
- source: us.gcr.io/sentryio/craft
1192
+ source: ghcr.io/getsentry/craft
1098
1193
  target: getsentry/craft
1099
- # Optional but strongly recommended
1100
- statusProvider:
1101
- name: github
1102
- config:
1103
- contexts:
1104
- - Travis CI - Branch # or whatever builds and pushes your source image
1194
+ ```
1195
+
1196
+ Publishing to GitHub Container Registry (zero-config in GitHub Actions):
1197
+
1198
+ ```yaml
1199
+ targets:
1200
+ # Uses GITHUB_ACTOR and GITHUB_TOKEN automatically
1201
+ - name: docker
1202
+ source: ghcr.io/getsentry/craft
1203
+ target: ghcr.io/getsentry/craft
1204
+ ```
1205
+
1206
+ Publishing to multiple registries:
1207
+
1208
+ ```yaml
1209
+ targets:
1210
+ # Docker Hub
1211
+ - name: docker
1212
+ source: ghcr.io/getsentry/craft
1213
+ target: getsentry/craft
1214
+ # Uses DOCKER_USERNAME / DOCKER_PASSWORD
1215
+
1216
+ # GHCR (auto-detected, zero-config in GitHub Actions)
1217
+ - name: docker
1218
+ source: ghcr.io/getsentry/craft
1219
+ target: ghcr.io/getsentry/craft
1220
+ # Uses DOCKER_GHCR_IO_* or GITHUB_ACTOR/GITHUB_TOKEN
1221
+
1222
+ # GCR with shared credentials across regions
1223
+ - name: docker
1224
+ source: ghcr.io/getsentry/craft
1225
+ target: us.gcr.io/my-project/craft
1226
+ registry: gcr.io # Use DOCKER_GCR_IO_* instead of DOCKER_US_GCR_IO_*
1227
+
1228
+ # Custom registry with explicit env vars
1229
+ - name: docker
1230
+ source: ghcr.io/getsentry/craft
1231
+ target: custom.registry.io/image
1232
+ usernameVar: MY_REGISTRY_USER
1233
+ passwordVar: MY_REGISTRY_PASS
1234
+ ```
1235
+
1236
+ Cross-registry publishing (private source to different target):
1237
+
1238
+ ```yaml
1239
+ targets:
1240
+ # Pull from private GHCR, push to Docker Hub
1241
+ # Requires DOCKER_GHCR_IO_* for source and DOCKER_USERNAME/PASSWORD for target
1242
+ - name: docker
1243
+ source: ghcr.io/myorg/private-image
1244
+ target: getsentry/craft
1245
+
1246
+ # Using object format with explicit source credentials
1247
+ - name: docker
1248
+ source:
1249
+ image: private.registry.io/image
1250
+ usernameVar: PRIVATE_REGISTRY_USER
1251
+ passwordVar: PRIVATE_REGISTRY_PASS
1252
+ target: getsentry/craft
1253
+ ```
1254
+
1255
+ Using nested object format (recommended for complex configs):
1256
+
1257
+ ```yaml
1258
+ targets:
1259
+ - name: docker
1260
+ source:
1261
+ image: ghcr.io/myorg/source-image
1262
+ format: "{{{source}}}:sha-{{{revision}}}"
1263
+ target:
1264
+ image: us.gcr.io/my-project/craft
1265
+ registry: gcr.io # Share creds across GCR regions
1266
+ format: "{{{target}}}:v{{{version}}}"
1267
+ ```
1268
+
1269
+ Publishing to Google Cloud registries (GCR/Artifact Registry):
1270
+
1271
+ Craft automatically detects Google Cloud registries (`gcr.io`, `*.gcr.io`, `*-docker.pkg.dev`) and configures Docker authentication using `gcloud auth configure-docker` when:
1272
+ - gcloud credentials are available (via `GOOGLE_APPLICATION_CREDENTIALS`, `GOOGLE_GHA_CREDS_PATH`, or default ADC location)
1273
+ - The `gcloud` CLI is installed
1274
+
1275
+ This works seamlessly with [google-github-actions/auth](https://github.com/google-github-actions/auth):
1276
+
1277
+ ```yaml
1278
+ # GitHub Actions workflow
1279
+ - uses: google-github-actions/auth@v2
1280
+ with:
1281
+ workload_identity_provider: ${{ vars.WORKLOAD_IDENTITY_PROVIDER }}
1282
+ service_account: ${{ vars.SERVICE_ACCOUNT }}
1283
+
1284
+ # Craft automatically runs: gcloud auth configure-docker us-docker.pkg.dev
1285
+ - run: craft publish ...
1286
+
1287
+ # .craft.yml - no credentials needed!
1288
+ targets:
1289
+ - name: docker
1290
+ source: ghcr.io/myorg/image
1291
+ target: us-docker.pkg.dev/my-project/repo/image
1292
+ ```
1293
+
1294
+ If you need to skip automatic detection (e.g., auth already configured), use `skipLogin`:
1295
+
1296
+ ```yaml
1297
+ targets:
1298
+ - name: docker
1299
+ source: ghcr.io/myorg/image
1300
+ target:
1301
+ image: us-docker.pkg.dev/my-project/repo/image
1302
+ skipLogin: true # Skip all auth, already configured
1105
1303
  ```
1106
1304
 
1107
1305
  ### Ruby Gems Index (`gem`)