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

Commit fddc690

Browse files
committed
ci: deploy workflow
1 parent d07796e commit fddc690

File tree

3 files changed

+101
-46
lines changed

3 files changed

+101
-46
lines changed

.github/workflows/deploy-cocoapods.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Deploy to CocoaPods
22

33
on:
4-
release:
5-
types: [published]
64
workflow_dispatch:
75

86
jobs:
@@ -31,9 +29,12 @@ jobs:
3129
pod lib lint openiap.podspec --allow-warnings
3230
3331
- name: Deploy to CocoaPods Trunk
34-
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
3532
env:
3633
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
3734
COCOAPODS_VALIDATOR_SKIP_XCODEBUILD: 1
3835
run: |
39-
pod trunk push openiap.podspec --allow-warnings
36+
if [ -z "$COCOAPODS_TRUNK_TOKEN" ]; then
37+
echo "COCOAPODS_TRUNK_TOKEN is not set. Skipping CocoaPods publish.";
38+
exit 0;
39+
fi
40+
pod trunk push openiap.podspec --allow-warnings

.github/workflows/deploy-swift.yml

Lines changed: 86 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,94 @@
1-
name: Deploy Swift Package
1+
name: Release Swift Package
22

33
on:
4-
release:
5-
types: [published]
64
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version to release (e.g., 1.2.3 or major/minor/patch)"
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: write
713

814
jobs:
9-
deploy:
15+
release:
1016
runs-on: macos-latest
11-
17+
1218
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-
git config user.name hyodotdev
30-
git config user.email hyo@hyo.dev
31-
32-
# Check if tag exists on remote
33-
if git ls-remote --tags origin | grep -q "refs/tags/$VERSION"; then
34-
echo "Tag $VERSION already exists on remote, skipping..."
35-
else
36-
# Create tag locally if not exists
37-
if ! git rev-parse "refs/tags/$VERSION" >/dev/null 2>&1; then
38-
git tag $VERSION
19+
- uses: actions/checkout@v4
20+
21+
- name: Select Xcode
22+
run: sudo xcode-select -s /Applications/Xcode.app
23+
24+
- name: Determine version
25+
id: set_version
26+
shell: bash
27+
run: |
28+
VERSION="${{ github.event.inputs.version }}"
29+
# Trim possible leading 'v'
30+
VERSION="${VERSION#v}"
31+
echo "VERSION=$VERSION" >> $GITHUB_ENV
32+
echo "Release version: $VERSION"
33+
34+
- name: Configure Git
35+
run: |
36+
git config user.name "hyodotdev"
37+
git config user.email "hyo@hyo.dev"
38+
39+
- name: Bump version and tag
40+
run: |
41+
./scripts/bump-version.sh "${{ env.VERSION }}"
42+
# Refresh VERSION to the computed value (handles major/minor/patch)
43+
NEW_VERSION=$(cat VERSION)
44+
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
45+
echo "Computed version: $NEW_VERSION"
46+
47+
- name: Build Package
48+
run: swift build
49+
50+
- name: Run Tests
51+
run: swift test
52+
53+
- name: Verify Package
54+
run: |
55+
swift package show-dependencies
56+
swift package describe
57+
58+
- name: Create GitHub Release
59+
uses: softprops/action-gh-release@v1
60+
with:
61+
tag_name: ${{ env.VERSION }}
62+
name: ${{ env.VERSION }}
63+
draft: false
64+
prerelease: false
65+
generate_release_notes: true
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
69+
- name: Setup Ruby
70+
uses: ruby/setup-ruby@v1
71+
with:
72+
ruby-version: '3.0'
73+
bundler-cache: true
74+
75+
- name: Install CocoaPods
76+
run: |
77+
gem list -i cocoapods || gem install cocoapods --no-document
78+
79+
- name: Validate Podspec
80+
env:
81+
COCOAPODS_VALIDATOR_SKIP_XCODEBUILD: 1
82+
run: |
83+
pod lib lint openiap.podspec --allow-warnings
84+
85+
- name: Publish to CocoaPods Trunk
86+
env:
87+
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
88+
COCOAPODS_VALIDATOR_SKIP_XCODEBUILD: 1
89+
run: |
90+
if [ -z "$COCOAPODS_TRUNK_TOKEN" ]; then
91+
echo "COCOAPODS_TRUNK_TOKEN is not set. Skipping CocoaPods publish.";
92+
exit 0;
3993
fi
40-
# Push tag
41-
git push origin $VERSION
42-
fi
43-
44-
- name: Verify Package
45-
run: |
46-
swift package show-dependencies
47-
swift package describe
94+
pod trunk push openiap.podspec --allow-warnings

CONTRIBUTING.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,17 @@ When your PR is merged, maintainers will handle the release:
106106
./scripts/bump-version.sh major # for breaking changes
107107
```
108108

109-
2. **Automatic Deployment**: Creating a GitHub release triggers:
109+
2. **Deployment Workflows (separated)**
110110

111-
- Swift Package Manager update (immediate)
112-
- CocoaPods deployment (via `pod trunk push`)
111+
- Swift Package (SPM):
112+
- Actions → "Release Swift Package" → Run workflow → enter version (e.g., `1.2.3` or `patch`).
113+
- This bumps version, commits, tags, creates a GitHub Release, and runs build/tests. SPM picks up new versions from git tags automatically.
114+
115+
- CocoaPods:
116+
- Actions → "Deploy to CocoaPods" → Run workflow.
117+
- Uses the current `openiap.podspec` version and publishes via `pod trunk push` (requires `COCOAPODS_TRUNK_TOKEN` repository secret).
118+
119+
- These are decoupled. Run SPM release and CocoaPods deploy independently, or run both sequentially (SPM first, then CocoaPods).
113120

114121
3. **Availability**:
115122
- Swift Package: Available immediately after release

0 commit comments

Comments
 (0)