Skip to content

docs: clarify urlTemplate usage and repo_url derivation for registry target#765

Closed
BYK wants to merge 15 commits intomasterfrom
docs/improve-registry-target-docs
Closed

docs: clarify urlTemplate usage and repo_url derivation for registry target#765
BYK wants to merge 15 commits intomasterfrom
docs/improve-registry-target-docs

Conversation

@BYK
Copy link
Member

@BYK BYK commented Mar 3, 2026

Summary

  • urlTemplate: Expanded the one-liner description to explain it generates artifact download URLs in the manifest using Mustache variables ({{version}}, {{file}}, {{revision}}), clarifying it's for apps/CDN-hosted assets and not needed for SDK packages on public registries (npm, PyPI, etc.). Also replaced the placeholder example.com URL in the example with a real-world URL (https://downloads.sentry-cdn.com/craft/{{version}}/{{file}}), and removed the erroneous urlTemplate line from the SDK example in "Creating New Packages".

  • repo_url: Replaced the vague "derived from your GitHub repository configuration" sentence with a dedicated ### repo_url subsection explaining the two-tier resolution: (1) auto-detection from the origin git remote (supports both HTTPS and SSH URLs, no config needed for most repos), and (2) explicit override via a top-level github: block in .craft.yml for edge cases where auto-detection isn't possible. Notes that the value is always overwritten on every publish.

@BYK BYK requested a review from s1gr1d March 3, 2026 10:18
BYK added 15 commits March 3, 2026 10:46
Add new commands and features to improve the onboarding experience:

- craft init: Auto-detect project type and generate configuration
  - Detects npm, pypi, crates, docker, gem, pub-dev targets
  - Generates .craft.yml with smart defaults
  - Creates GitHub Actions workflows (release, publish, changelog-preview)

- craft validate: Validate configuration and workflows
  - Checks YAML syntax and schema
  - Validates target names and regex patterns
  - Warns about deprecated fields and missing best practices

- Smart defaults for minVersion >= 2.20.0
  - changelog.policy defaults to 'auto'
  - versioning.policy defaults to 'auto' (>= 2.14.0)

- First release improvements
  - Defaults to version 0.1.0 when no tags exist
  - Creates CHANGELOG.md automatically with auto policy

- Documentation updates for all new features
- Fix docs: Change 'craft prepare auto' to 'craft prepare' in quick example
- Merge first release logic with version calculation:
  - Use default bump type (minor) instead of hardcoded version
  - Allow explicit bump types to work for first release (e.g., major -> 1.0.0)
  - More consistent code flow
Makes the test portable across environments with custom TMPDIR settings.
String comparison was incorrectly evaluating versions like '2.3.0' as
greater than '2.20.0'. Now uses parseVersion() and versionGreaterOrEqualThan()
for proper semver comparison.
Updates all references to the smart defaults minimum version across
source code, tests, and documentation.
Address PR review feedback:

1. Move language detection (Node.js, Python) from init.ts to respective
   targets (NpmTarget, PypiTarget). Each target now returns workflowSetup
   and requiredSecrets in its detection result.

2. Add static priority property to each target class instead of
   centralized TargetPriority constant. Targets now own their priority.

3. Update init.ts to aggregate workflowSetup and requiredSecrets from
   all detected targets instead of maintaining separate detection logic.

4. Update validate.ts to scan all workflow files for Craft patterns
   instead of only checking hardcoded release.yml filename.

5. Remove publish.yml workflow generation (Sentry uses separate publish
   repo for secrets management).

6. Update TemplateContext to use unified workflowSetup interface with
   node and python sub-objects.

7. Update tests to use target class priorities and new workflowSetup
   interface.
1. Use getChangelogConfig() in prepare.ts instead of reading raw config
   - This ensures smart defaults (auto changelog for minVersion >= 2.21.0) work

2. Remove unused ciJobName and hasDocker from TemplateContext interface
   - These properties were defined but never consumed

3. Display aggregated requiredSecrets in init.ts 'Next steps' output
   - Previously collected but never displayed to user
   - Now shows all target-specific secrets with descriptions
…get detection

When craft init runs without a GitHub remote, DockerTarget.detect() now
defaults to Docker Hub placeholders instead of returning an invalid config
without source/target properties.

- Uses 'YOUR_DOCKERHUB_USERNAME/YOUR_REPO' as placeholder values
- Adds DOCKER_USERNAME and DOCKER_PASSWORD to requiredSecrets for Docker Hub
- Fixes BugBot issue: Docker target detection generates invalid config
1. Change GH_TOKEN to GITHUB_TOKEN in release workflow
   - Craft reads GITHUB_TOKEN, not GH_TOKEN

2. Fix changelog preview to use reusable workflow
   - Was incorrectly using composite action with non-existent 'action' input
   - Now calls getsentry/craft/.github/workflows/changelog-preview.yml@v2
   - Uses pull_request_target for fork PR support
   - Sets required permissions (contents: read, pull-requests: write)

3. Remove unsupported dry-run input from release workflow
   - The composite action doesn't accept dry-run input
   - Was silently ignored, potentially causing unexpected releases
Workflows using Craft reusable workflows (job-level uses: getsentry/craft/.github/workflows/...)
are now recognized as a valid pattern. These are self-contained and don't need fetch-depth: 0
since they handle their own checkout internally.

This fixes false-positive warnings for changelog-preview.yml generated by craft init.
…plicate secrets

- Add getGitHubInfoFromRemote() to src/utils/git.ts as shared utility
- Update init.ts to use the shared utility instead of duplicating logic
- Update config.ts to use the shared utility in getGlobalGitHubConfig()
- Remove hardcoded GH_RELEASE_PAT from init 'Next steps' output
- Secrets are now aggregated from target detection results

This fixes:
- GH_RELEASE_PAT appearing twice in init output when GitHub target is detected
- Duplicated GitHub remote detection logic between init.ts and config.ts
Remove the internal try/catch from getGitHubInfoFromRemote() so that
errors propagate naturally. This restores the logger.warn in config.ts's
getGlobalGitHubConfig() and lets each caller decide how to handle errors.

- config.ts: already has try/catch with logger.warn (no longer dead code)
- init.ts: added try/catch with logger.debug for graceful degradation
Consolidate the two nearly identical return statements for pyproject.toml
and setup.py code paths into a single return using an isPythonPackage flag.
Export SMART_DEFAULTS_MIN_VERSION from config.ts and use it in
validate.ts and templates.ts instead of independent string literals.
This ensures the threshold version is defined in one place.
@BYK BYK force-pushed the docs/improve-registry-target-docs branch from 8f56e02 to d64a2c0 Compare March 3, 2026 10:47
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-03-03 10:50 UTC

@BYK
Copy link
Member Author

BYK commented Mar 3, 2026

Superseded by a clean cherry-pick onto master — see new PR.

@BYK BYK closed this Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant