docs: clarify urlTemplate usage and repo_url derivation for registry target#765
Closed
docs: clarify urlTemplate usage and repo_url derivation for registry target#765
Conversation
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.
8f56e02 to
d64a2c0
Compare
Contributor
|
Member
Author
|
Superseded by a clean cherry-pick onto master — see new PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 placeholderexample.comURL in the example with a real-world URL (https://downloads.sentry-cdn.com/craft/{{version}}/{{file}}), and removed the erroneousurlTemplateline from the SDK example in "Creating New Packages".repo_url: Replaced the vague "derived from your GitHub repository configuration" sentence with a dedicated### repo_urlsubsection explaining the two-tier resolution: (1) auto-detection from theorigingit remote (supports both HTTPS and SSH URLs, no config needed for most repos), and (2) explicit override via a top-levelgithub:block in.craft.ymlfor edge cases where auto-detection isn't possible. Notes that the value is always overwritten on every publish.