Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Commit 437eb4a

Browse files
authored
Setup deployment pipeline (#1)
- Add CI/CD workflows for Swift Package and CocoaPods - Add version management system - Add contributing guide
1 parent 9a7a379 commit 437eb4a

File tree

6 files changed

+272
-23
lines changed

6 files changed

+272
-23
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy to CocoaPods
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
deploy:
10+
runs-on: macos-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Select Xcode
16+
run: |
17+
sudo xcode-select -s /Applications/Xcode.app
18+
19+
- name: Setup Ruby
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: '3.0'
23+
bundler-cache: true
24+
25+
- name: Install CocoaPods
26+
run: |
27+
gem install cocoapods
28+
29+
- name: Validate Podspec
30+
run: |
31+
pod lib lint IosIAP.podspec --allow-warnings
32+
33+
- name: Deploy to CocoaPods Trunk
34+
if: github.event_name == 'release'
35+
env:
36+
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
37+
COCOAPODS_VALIDATOR_SKIP_XCODEBUILD: 1
38+
run: |
39+
pod trunk push IosIAP.podspec --allow-warnings

.github/workflows/deploy-swift.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy Swift Package
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
deploy:
10+
runs-on: macos-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Select Xcode
16+
run: |
17+
sudo xcode-select -s /Applications/Xcode.app
18+
19+
- name: Build Package
20+
run: swift build
21+
22+
- name: Run Tests
23+
run: swift test
24+
25+
- name: Create git tag if not exists
26+
if: github.event_name == 'workflow_dispatch'
27+
run: |
28+
VERSION=$(cat VERSION)
29+
if ! git rev-parse "refs/tags/$VERSION" >/dev/null 2>&1; then
30+
git config user.name hyodotdev
31+
git config user.email hyo@hyo.dev
32+
git tag $VERSION
33+
git push origin $VERSION
34+
fi
35+
36+
- name: Verify Package
37+
run: |
38+
swift package show-dependencies
39+
swift package describe

CONTRIBUTING.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Contributing to IosIAP
2+
3+
Thank you for your interest in contributing! We love your input and appreciate your efforts to make IosIAP better.
4+
5+
## Quick Start
6+
7+
1. Fork the repository
8+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
9+
3. Make your changes
10+
4. Run tests (`swift test`)
11+
5. Commit your changes (`git commit -m 'Add amazing feature'`)
12+
6. Push to your branch (`git push origin feature/amazing-feature`)
13+
7. Open a Pull Request
14+
15+
## Development Setup
16+
17+
```bash
18+
# Clone your fork
19+
git clone https://github.com/YOUR_USERNAME/ios-iap.git
20+
cd ios-iap
21+
22+
# Open in Xcode
23+
open Package.swift
24+
25+
# Run tests
26+
swift test
27+
```
28+
29+
## Code Style
30+
31+
- Follow Swift API Design Guidelines
32+
- Use meaningful variable and function names
33+
- Keep functions small and focused
34+
- Add comments only when necessary
35+
36+
### Naming Conventions
37+
38+
- **Acronyms**: Use Pascal case when at beginning/middle (`IapModule`, `IosIapTests`)
39+
- **Acronyms as suffix**: Use all caps (`ProductIAP`, `ManagerIOS`)
40+
- See [CLAUDE.md](CLAUDE.md) for detailed naming rules
41+
42+
## Testing
43+
44+
All new features must include tests:
45+
46+
```swift
47+
func testYourFeature() async throws {
48+
// Arrange
49+
let module = IapModule.shared
50+
51+
// Act
52+
let result = try await module.yourMethod()
53+
54+
// Assert
55+
XCTAssertEqual(result, expectedValue)
56+
}
57+
```
58+
59+
## Pull Request Guidelines
60+
61+
### ✅ Do
62+
63+
- Write clear PR titles and descriptions
64+
- Include tests for new features
65+
- Update documentation if needed
66+
- Keep changes focused and small
67+
68+
### ❌ Don't
69+
70+
- Mix unrelated changes in one PR
71+
- Break existing tests
72+
- Change code style without discussion
73+
- Include commented-out code
74+
75+
## Commit Messages
76+
77+
Keep them clear and concise:
78+
79+
- `Add purchase error recovery`
80+
- `Fix subscription status check`
81+
- `Update StoreKit 2 integration`
82+
- `Refactor transaction handling`
83+
84+
## Release Process (Maintainers Only)
85+
86+
When your PR is merged, maintainers will handle the release:
87+
88+
1. **Version Update**: We use semantic versioning (major.minor.patch)
89+
```bash
90+
./scripts/bump-version.sh patch # for bug fixes
91+
./scripts/bump-version.sh minor # for new features
92+
./scripts/bump-version.sh major # for breaking changes
93+
```
94+
95+
2. **Automatic Deployment**: Creating a GitHub release triggers:
96+
- Swift Package Manager update (immediate)
97+
- CocoaPods deployment (via `pod trunk push`)
98+
99+
3. **Availability**:
100+
- Swift Package: Available immediately after release
101+
- CocoaPods: Available within ~10 minutes via `pod update`
102+
103+
Contributors don't need to worry about deployment - just focus on making great contributions!
104+
105+
## Questions?
106+
107+
Feel free to:
108+
- Open an issue for bugs or features
109+
- Start a discussion for questions
110+
- Tag @hyodotdev for urgent matters
111+
112+
## License
113+
114+
By contributing, you agree that your contributions will be licensed under the MIT License.

IosIAP.podspec

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1-
Pod::Spec.new do |spec|
2-
spec.name = "IosIAP"
3-
spec.version = "1.0.0"
4-
spec.summary = "iOS In-App Purchase library following OpenIAP specification"
5-
spec.description = <<-DESC
6-
A comprehensive iOS In-App Purchase library that follows the OpenIAP specification.
7-
Simplifies the integration of in-app purchases in iOS applications with a clean API.
1+
Pod::Spec.new do |s|
2+
s.name = 'IosIAP'
3+
s.version = '1.0.0'
4+
s.summary = 'iOS In-App Purchase library using StoreKit 2'
5+
s.description = <<-DESC
6+
IosIAP is a modern Swift library for handling iOS in-app purchases using StoreKit 2.
7+
It provides a clean, async/await based API for managing products, purchases, and subscriptions.
88
DESC
9+
10+
s.homepage = 'https://github.com/hyodotdev/ios-iap'
11+
s.license = { :type => 'MIT', :file => 'LICENSE' }
12+
s.author = { 'hyodotdev' => 'hyo@hyo.dev' }
13+
s.source = { :git => 'https://github.com/hyodotdev/ios-iap.git', :tag => s.version.to_s }
14+
15+
s.ios.deployment_target = '13.0'
16+
s.osx.deployment_target = '10.15'
17+
s.tvos.deployment_target = '13.0'
18+
s.watchos.deployment_target = '6.0'
19+
20+
s.swift_version = '5.0'
21+
s.source_files = 'Sources/**/*.swift'
922

10-
spec.homepage = "https://github.com/hyochan/ios-iap"
11-
spec.license = { :type => "MIT", :file => "LICENSE" }
12-
spec.author = { "hyochan" => "your-email@example.com" }
13-
14-
spec.ios.deployment_target = "13.0"
15-
spec.osx.deployment_target = "10.15"
16-
spec.tvos.deployment_target = "13.0"
17-
spec.watchos.deployment_target = "6.0"
18-
19-
spec.source = { :git => "https://github.com/hyochan/ios-iap.git", :tag => "#{spec.version}" }
20-
spec.source_files = "Sources/IosIAP/**/*.swift"
21-
22-
spec.swift_version = "5.9"
23-
spec.frameworks = "StoreKit"
24-
25-
spec.requires_arc = true
23+
s.frameworks = 'StoreKit'
24+
s.requires_arc = true
2625
end

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.0

scripts/bump-version.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
3+
# Usage: ./scripts/bump-version.sh [major|minor|patch|x.x.x]
4+
5+
set -e
6+
7+
# Get current version
8+
CURRENT_VERSION=$(cat VERSION)
9+
echo "Current version: $CURRENT_VERSION"
10+
11+
# Parse version components
12+
IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION"
13+
MAJOR="${VERSION_PARTS[0]}"
14+
MINOR="${VERSION_PARTS[1]}"
15+
PATCH="${VERSION_PARTS[2]}"
16+
17+
# Determine new version
18+
if [ -z "$1" ]; then
19+
echo "Usage: $0 [major|minor|patch|x.x.x]"
20+
exit 1
21+
fi
22+
23+
case "$1" in
24+
major)
25+
NEW_VERSION="$((MAJOR + 1)).0.0"
26+
;;
27+
minor)
28+
NEW_VERSION="${MAJOR}.$((MINOR + 1)).0"
29+
;;
30+
patch)
31+
NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
32+
;;
33+
*)
34+
# Direct version number provided
35+
NEW_VERSION="$1"
36+
;;
37+
esac
38+
39+
echo "New version: $NEW_VERSION"
40+
41+
# Update VERSION file
42+
echo "$NEW_VERSION" > VERSION
43+
44+
# Update IosIAP.podspec
45+
sed -i '' "s/s.version.*=.*'.*'/s.version = '$NEW_VERSION'/" IosIAP.podspec
46+
47+
# Commit changes
48+
git add VERSION IosIAP.podspec
49+
git commit -m "Bump version to $NEW_VERSION"
50+
51+
# Create and push tag
52+
git tag "$NEW_VERSION"
53+
git push origin main
54+
git push origin "$NEW_VERSION"
55+
56+
echo "✅ Version bumped to $NEW_VERSION and pushed!"
57+
echo "📦 Ready to create a GitHub Release with tag $NEW_VERSION"

0 commit comments

Comments
 (0)