Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.
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
39 changes: 39 additions & 0 deletions .github/workflows/deploy-cocoapods.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy to CocoaPods

on:
release:
types: [published]
workflow_dispatch:

jobs:
deploy:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3

- name: Select Xcode
run: |
sudo xcode-select -s /Applications/Xcode.app

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true

- name: Install CocoaPods
run: |
gem install cocoapods

- name: Validate Podspec
run: |
pod lib lint IosIAP.podspec --allow-warnings

- name: Deploy to CocoaPods Trunk
if: github.event_name == 'release'
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
COCOAPODS_VALIDATOR_SKIP_XCODEBUILD: 1
run: |
pod trunk push IosIAP.podspec --allow-warnings
39 changes: 39 additions & 0 deletions .github/workflows/deploy-swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy Swift Package

on:
release:
types: [published]
workflow_dispatch:

jobs:
deploy:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3

- name: Select Xcode
run: |
sudo xcode-select -s /Applications/Xcode.app

- name: Build Package
run: swift build

- name: Run Tests
run: swift test

- name: Create git tag if not exists
if: github.event_name == 'workflow_dispatch'
run: |
VERSION=$(cat VERSION)
if ! git rev-parse "refs/tags/$VERSION" >/dev/null 2>&1; then
git config user.name hyodotdev
git config user.email hyo@hyo.dev
git tag $VERSION
git push origin $VERSION
fi

- name: Verify Package
run: |
swift package show-dependencies
swift package describe
114 changes: 114 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Contributing to IosIAP

Thank you for your interest in contributing! We love your input and appreciate your efforts to make IosIAP better.

## Quick Start

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes
4. Run tests (`swift test`)
5. Commit your changes (`git commit -m 'Add amazing feature'`)
6. Push to your branch (`git push origin feature/amazing-feature`)
7. Open a Pull Request

## Development Setup

```bash
# Clone your fork
git clone https://github.com/YOUR_USERNAME/ios-iap.git
cd ios-iap

# Open in Xcode
open Package.swift

# Run tests
swift test
```

## Code Style

- Follow Swift API Design Guidelines
- Use meaningful variable and function names
- Keep functions small and focused
- Add comments only when necessary

### Naming Conventions

- **Acronyms**: Use Pascal case when at beginning/middle (`IapModule`, `IosIapTests`)
- **Acronyms as suffix**: Use all caps (`ProductIAP`, `ManagerIOS`)
- See [CLAUDE.md](CLAUDE.md) for detailed naming rules

## Testing

All new features must include tests:

```swift
func testYourFeature() async throws {
// Arrange
let module = IapModule.shared

// Act
let result = try await module.yourMethod()

// Assert
XCTAssertEqual(result, expectedValue)
}
```

## Pull Request Guidelines

### ✅ Do

- Write clear PR titles and descriptions
- Include tests for new features
- Update documentation if needed
- Keep changes focused and small

### ❌ Don't

- Mix unrelated changes in one PR
- Break existing tests
- Change code style without discussion
- Include commented-out code

## Commit Messages

Keep them clear and concise:

- `Add purchase error recovery`
- `Fix subscription status check`
- `Update StoreKit 2 integration`
- `Refactor transaction handling`

## Release Process (Maintainers Only)

When your PR is merged, maintainers will handle the release:

1. **Version Update**: We use semantic versioning (major.minor.patch)
```bash
./scripts/bump-version.sh patch # for bug fixes
./scripts/bump-version.sh minor # for new features
./scripts/bump-version.sh major # for breaking changes
```

2. **Automatic Deployment**: Creating a GitHub release triggers:
- Swift Package Manager update (immediate)
- CocoaPods deployment (via `pod trunk push`)

3. **Availability**:
- Swift Package: Available immediately after release
- CocoaPods: Available within ~10 minutes via `pod update`

Contributors don't need to worry about deployment - just focus on making great contributions!

## Questions?

Feel free to:
- Open an issue for bugs or features
- Start a discussion for questions
- Tag @hyodotdev for urgent matters

## License

By contributing, you agree that your contributions will be licensed under the MIT License.
45 changes: 22 additions & 23 deletions IosIAP.podspec
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
Pod::Spec.new do |spec|
spec.name = "IosIAP"
spec.version = "1.0.0"
spec.summary = "iOS In-App Purchase library following OpenIAP specification"
spec.description = <<-DESC
A comprehensive iOS In-App Purchase library that follows the OpenIAP specification.
Simplifies the integration of in-app purchases in iOS applications with a clean API.
Pod::Spec.new do |s|
s.name = 'IosIAP'
s.version = '1.0.0'
s.summary = 'iOS In-App Purchase library using StoreKit 2'
s.description = <<-DESC
IosIAP is a modern Swift library for handling iOS in-app purchases using StoreKit 2.
It provides a clean, async/await based API for managing products, purchases, and subscriptions.
DESC

s.homepage = 'https://github.com/hyodotdev/ios-iap'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'hyodotdev' => 'hyo@hyo.dev' }
s.source = { :git => 'https://github.com/hyodotdev/ios-iap.git', :tag => s.version.to_s }

s.ios.deployment_target = '13.0'
s.osx.deployment_target = '10.15'
s.tvos.deployment_target = '13.0'
s.watchos.deployment_target = '6.0'

s.swift_version = '5.0'
s.source_files = 'Sources/**/*.swift'

spec.homepage = "https://github.com/hyochan/ios-iap"
spec.license = { :type => "MIT", :file => "LICENSE" }
spec.author = { "hyochan" => "your-email@example.com" }

spec.ios.deployment_target = "13.0"
spec.osx.deployment_target = "10.15"
spec.tvos.deployment_target = "13.0"
spec.watchos.deployment_target = "6.0"

spec.source = { :git => "https://github.com/hyochan/ios-iap.git", :tag => "#{spec.version}" }
spec.source_files = "Sources/IosIAP/**/*.swift"

spec.swift_version = "5.9"
spec.frameworks = "StoreKit"

spec.requires_arc = true
s.frameworks = 'StoreKit'
s.requires_arc = true
end
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
57 changes: 57 additions & 0 deletions scripts/bump-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

# Usage: ./scripts/bump-version.sh [major|minor|patch|x.x.x]

set -e

# Get current version
CURRENT_VERSION=$(cat VERSION)
echo "Current version: $CURRENT_VERSION"

# Parse version components
IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION"
MAJOR="${VERSION_PARTS[0]}"
MINOR="${VERSION_PARTS[1]}"
PATCH="${VERSION_PARTS[2]}"

# Determine new version
if [ -z "$1" ]; then
echo "Usage: $0 [major|minor|patch|x.x.x]"
exit 1
fi

case "$1" in
major)
NEW_VERSION="$((MAJOR + 1)).0.0"
;;
minor)
NEW_VERSION="${MAJOR}.$((MINOR + 1)).0"
;;
patch)
NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
;;
*)
# Direct version number provided
NEW_VERSION="$1"
;;
esac

echo "New version: $NEW_VERSION"

# Update VERSION file
echo "$NEW_VERSION" > VERSION

# Update IosIAP.podspec
sed -i '' "s/s.version.*=.*'.*'/s.version = '$NEW_VERSION'/" IosIAP.podspec

# Commit changes
git add VERSION IosIAP.podspec
git commit -m "Bump version to $NEW_VERSION"

# Create and push tag
git tag "$NEW_VERSION"
git push origin main
git push origin "$NEW_VERSION"

echo "✅ Version bumped to $NEW_VERSION and pushed!"
echo "📦 Ready to create a GitHub Release with tag $NEW_VERSION"
Loading