Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/pr-label-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ jobs:
HAS_MAJOR=$(echo "$LABELS" | grep -c '"major"' || true)
HAS_MINOR=$(echo "$LABELS" | grep -c '"minor"' || true)
HAS_PATCH=$(echo "$LABELS" | grep -c '"patch"' || true)
HAS_CHORE=$(echo "$LABELS" | grep -c '"chore"' || true)

COUNT=$((HAS_MAJOR + HAS_MINOR + HAS_PATCH))
COUNT=$((HAS_MAJOR + HAS_MINOR + HAS_PATCH + HAS_CHORE))

if [ "$COUNT" -eq 0 ]; then
echo "::error::PR must have one of: major, minor, patch label"
echo "::error::PR must have one of: major, minor, patch, chore label"
exit 1
elif [ "$COUNT" -gt 1 ]; then
echo "::error::PR must have exactly one version label (major, minor, or patch). Found multiple."
echo "::error::PR must have exactly one label (major, minor, patch, or chore). Found multiple."
exit 1
fi

echo "✓ Version label found"
echo "✓ Label found"
27 changes: 19 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# - "major" label → 1.2.3 → 2.0.0
# - "minor" label → 1.2.3 → 1.3.0
# - "patch" label → 1.2.3 → 1.2.4 (also the default fallback)
# - "chore" label → no release (CI housekeeping, docs, relicense, etc.)
# 3. Decodes your keystore from a GitHub secret
# 4. Builds a signed release APK with the new version
# 5. Creates a GitHub Release with the APK attached
Expand All @@ -27,23 +28,24 @@ permissions:
contents: write

jobs:
build:
detect:
runs-on: ubuntu-latest

outputs:
type: ${{ steps.bump.outputs.type }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Detect bump type from merged PR labels
id: bump
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Find the PR associated with this merge commit
COMMIT_SHA="${{ github.sha }}"
LABELS=$(gh pr list --state merged --search "$COMMIT_SHA" --json labels -q '.[0].labels[].name' 2>/dev/null || echo "")
LABELS=$(gh pr list --state merged --search "$COMMIT_SHA" --repo "${{ github.repository }}" --json labels -q '.[0].labels[].name' 2>/dev/null || echo "")

if echo "$LABELS" | grep -qi "major"; then
if echo "$LABELS" | grep -qi "chore"; then
echo "type=chore" >> "$GITHUB_OUTPUT"
echo "Chore PR — skipping release"
elif echo "$LABELS" | grep -qi "major"; then
echo "type=major" >> "$GITHUB_OUTPUT"
elif echo "$LABELS" | grep -qi "minor"; then
echo "type=minor" >> "$GITHUB_OUTPUT"
Expand All @@ -52,6 +54,15 @@ jobs:
fi
echo "Bump type: $(grep type "$GITHUB_OUTPUT" | cut -d= -f2)"

build:
needs: detect
if: needs.detect.outputs.type != 'chore'
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Determine next version
id: version
env:
Expand All @@ -70,7 +81,7 @@ jobs:

# Parse semver
IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST"
BUMP="${{ steps.bump.outputs.type }}"
BUMP="${{ needs.detect.outputs.type }}"

if [ "$BUMP" = "major" ]; then
MAJOR=$((MAJOR + 1))
Expand Down
6 changes: 4 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

## PR Creation Rules

When creating a PR to `master`, you MUST add exactly one version label based on the changes:
When creating a PR to `master`, you MUST add exactly one label based on the changes:

- **`major`** — Breaking changes, major new features, architecture overhaul
- **`minor`** — New features, significant enhancements, new UI screens
- **`patch`** — Bug fixes, small tweaks, translation updates, dependency bumps
- **`chore`** — CI/workflow changes, docs-only edits, relicensing, repo housekeeping (no release is cut)

Use `gh pr create --label <label>` to include the label when creating the PR.

Analyze the diff to determine the appropriate version bump:
Analyze the diff to determine the appropriate label:
- If the change adds new user-facing functionality → `minor`
- If the change fixes a bug or makes small adjustments → `patch`
- If the change breaks backward compatibility or is a major overhaul → `major`
- If the change does not affect the shipped APK (CI, README, LICENSE, `.github/`, `docs/`) → `chore`
- When in doubt, default to `patch`

## Development Approach
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ Existing translations: en, ko, de, es, fr, ja, nl, no, zh-CN

## License

By contributing, you agree that your contributions will be licensed under the GPL-3.0 License.
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.
Loading