Skip to content

feat(github): Integrate action-prepare-release into Craft repo - #667

Merged
BYK merged 6 commits into
masterfrom
byk/feat/action-in-craft
Dec 24, 2025
Merged

BYK merged 6 commits into
masterfrom
byk/feat/action-in-craft

Conversation

@BYK

@BYK BYK commented Dec 23, 2025

Copy link
Copy Markdown
Member

Move the action-prepare-release GitHub Action into the Craft repository root,
enabling usage as getsentry/craft@v2. This provides better version alignment
and allows Craft to dogfood its own action.

  • Add floatingTags config option to create/update floating tags (e.g., v2)

  • Support placeholders: {major}, {minor}, {patch}

  • Example: floatingTags: ['v{major}'] creates v2 tag for version 2.15.0

  • Parametrized inputs replacing hardcoded Sentry-specific values:

    • blocker_label (default: release-blocker)
    • publish_repo (default: ${{ github.repository_owner }}/publish)
    • git_user_name, git_user_email (default to GITHUB_ACTOR)
  • Smart Craft installation:

    • Downloads from build artifact when in getsentry/craft repo
    • Falls back to release download using github.action_ref
  • Outputs resolved version for downstream steps

  • build.yml: Add workflow_call trigger for reusability

  • release.yml: Call build workflow first, then use local action for dogfooding

  • Add floatingTags: ['v{major}'] to github target in .craft.yml

Repos using getsentry/action-prepare-release@v1 can migrate to:

uses: getsentry/craft@v2
with:
  version: auto
  git_user_name: getsentry-bot  # if needed
  git_user_email: bot@sentry.io  # if needed

@BYK
BYK requested a review from hubertdeng123 December 23, 2025 21:23
@BYK
BYK force-pushed the byk/feat/action-in-craft branch from 663bd11 to 0c472be Compare December 23, 2025 21:26
BYK added 2 commits December 23, 2025 21:53
Move the action-prepare-release GitHub Action into the Craft repository root,
enabling usage as `getsentry/craft@v2`. This provides better version alignment
and allows Craft to dogfood its own action.

- Add `floatingTags` config option to create/update floating tags (e.g., v2)
- Support placeholders: {major}, {minor}, {patch}
- Example: `floatingTags: ['v{major}']` creates v2 tag for version 2.15.0

- Parametrized inputs replacing hardcoded Sentry-specific values:
  - `blocker_label` (default: release-blocker)
  - `publish_repo` (default: ${{ github.repository_owner }}/publish)
  - `git_user_name`, `git_user_email` (default to GITHUB_ACTOR)
- Smart Craft installation:
  - Downloads from build artifact when in getsentry/craft repo
  - Falls back to release download using github.action_ref
- Outputs resolved version for downstream steps

- build.yml: Add workflow_call trigger for reusability
- release.yml: Call build workflow first, then use local action for dogfooding

- Add `floatingTags: ['v{major}']` to github target in .craft.yml

Repos using `getsentry/action-prepare-release@v1` can migrate to:
```yaml
uses: getsentry/craft@v2
with:
  version: auto
  git_user_name: getsentry-bot  # if needed
  git_user_email: bot@sentry.io  # if needed
```
Add a new `versioning` configuration option to `.craft.yml` that supports
`auto`, `manual`, and `calver` policies for version resolution.

## New Configuration

```yaml
versioning:
  policy: auto | manual | calver  # default based on minVersion
  calver:
    offset: 14       # days to go back (default: 14)
    format: '%y.%-m' # strftime-like format (default: '%y.%-m')
```

## Behavior

- `craft prepare` (no arg): Uses `versioning.policy` from config
  - `auto`: Analyze commits to determine bump type
  - `manual`: Error if no version specified
  - `calver`: Use calendar versioning
- `craft prepare calver`: Explicit CalVer override
- `craft prepare auto`: Explicit auto-versioning override
- `craft prepare 1.2.3`: Explicit version always works

## Policy Defaults

- `auto` if `minVersion >= 2.14.0`
- `manual` otherwise (backward compatible)

## New CLI Options

- `--calver-offset`: Override CalVer offset (days to go back)

## Environment Variables

- `CRAFT_CALVER_OFFSET`: Override CalVer offset

## CalVer Format

Supports strftime-like placeholders:
- `%y`: 2-digit year (e.g., "24")
- `%Y`: 4-digit year (e.g., "2024")
- `%m`: Zero-padded month (e.g., "01")
- `%-m`: Month without padding (e.g., "1")
- `%d`: Zero-padded day
- `%-d`: Day without padding

Example: `%y.%-m` produces "24.12" for December 2024
@BYK
BYK force-pushed the byk/feat/action-in-craft branch from 0c472be to fce2ee0 Compare December 23, 2025 22:33
@BYK
BYK marked this pull request as ready for review December 23, 2025 22:45
Comment thread src/utils/calver.ts
@hubertdeng123

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

馃 Generated with Claude Code

Comment thread src/commands/prepare.ts
description: 'Load .craft.yml from the specified remote branch instead of local file',
type: 'string',
})
.option('calver-offset', {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under what circumstance would this be needed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For us, never as we always use the default value 14. But since Craft is meant to be a generic tool, some other folks may want to tweak this value.

Comment thread .github/workflows/release.yml
Comment thread src/commands/prepare.ts Outdated
@BYK
BYK merged commit 2f8efe0 into master Dec 24, 2025
14 checks passed
@BYK
BYK deleted the byk/feat/action-in-craft branch December 24, 2025 00:00
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.

2 participants