Skip to content

Commit bd75d8d

Browse files
committed
Merge remote-tracking branch 'origin/main' into codex/pr-91-conflict-fix
# Conflicts: # .github/scripts/verify-packed-example.sh # example-app/package.json
2 parents c5ff15b + c03342a commit bd75d8d

63 files changed

Lines changed: 753 additions & 159 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/scripts/verify-packed-example.sh

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,45 @@ bun remove "$plugin_name"
3838
bun add "${packed_packages[0]}"
3939
bun run build
4040

41+
ensure_platform() {
42+
local platform="$1"
43+
if [ -e "$platform" ]; then
44+
if [ ! -d "$platform" ]; then
45+
echo "Expected $platform to be a directory"
46+
exit 1
47+
fi
48+
return
49+
fi
50+
51+
local output
52+
if ! output="$(bunx cap add "$platform" 2>&1)"; then
53+
printf '%s\n' "$output"
54+
if [[ "$output" == *"$platform platform already exists"* ]]; then
55+
return
56+
fi
57+
exit 1
58+
fi
59+
printf '%s\n' "$output"
60+
}
61+
4162
case "$platform" in
4263
android)
43-
if [ ! -d android ]; then
44-
bunx cap add android
45-
fi
64+
ensure_platform android
4665
bunx cap sync android
4766
cd android
4867
./gradlew build test
4968
;;
5069
ios)
51-
if [ ! -d ios ]; then
52-
bunx cap add ios
53-
fi
70+
ensure_platform ios
5471
bunx cap sync ios
55-
xcodebuild -project ios/App/App.xcodeproj -scheme App -destination generic/platform=iOS CODE_SIGNING_ALLOWED=NO
72+
rm -rf "$HOME/Library/Caches/org.swift.swiftpm/artifacts"/https___github_com_ionic_team_capacitor_swift_pm_releases_download_*
73+
xcodebuild \
74+
-project ios/App/App.xcodeproj \
75+
-scheme App \
76+
-destination generic/platform=iOS \
77+
-clonedSourcePackagesDirPath "$tmp_root/plugin-example-swiftpm" \
78+
-derivedDataPath "$tmp_root/plugin-example-derived-data" \
79+
CODE_SIGNING_ALLOWED=NO
5680
;;
5781
web)
5882
;;

.github/workflows/build.yml

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ on:
1212
jobs:
1313
# Tests already passed before tag was created, so just build and deploy
1414
deploy:
15-
timeout-minutes: 30
1615
runs-on: ubuntu-latest
16+
# Keep this job capped at 10 minutes; never raise it unless explicitly asked.
17+
timeout-minutes: 10
1718
name: "Build and publish to npm"
1819
permissions:
1920
contents: write
@@ -33,13 +34,49 @@ jobs:
3334
- name: Build
3435
id: build_code
3536
run: bun run build
37+
- name: Detect previous tag
38+
id: previous_tag
39+
shell: bash
40+
run: |
41+
current_tag="${GITHUB_REF##*/}"
42+
echo "current=$current_tag" >> "$GITHUB_OUTPUT"
43+
if previous_tag=$(git describe --tags --abbrev=0 "${current_tag}^" 2>/dev/null); then
44+
echo "found=true" >> "$GITHUB_OUTPUT"
45+
echo "value=$previous_tag" >> "$GITHUB_OUTPUT"
46+
else
47+
echo "found=false" >> "$GITHUB_OUTPUT"
48+
fi
3649
- name: Generate AI changelog
3750
id: changelog
38-
uses: mistricky/ccc@v0.2.3
51+
if: ${{ steps.previous_tag.outputs.found == 'true' }}
52+
uses: mistricky/ccc@v0.2.6
3953
with:
4054
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
4155
github_token: ${{ secrets.GITHUB_TOKEN }}
4256
model: claude-sonnet-4-5-20250929
57+
- name: Prepare release notes
58+
id: release_notes
59+
shell: bash
60+
env:
61+
CURRENT_TAG: ${{ steps.previous_tag.outputs.current }}
62+
PREVIOUS_TAG: ${{ steps.previous_tag.outputs.value }}
63+
CHANGELOG_TEXT: ${{ steps.changelog.outputs.result }}
64+
run: |
65+
if [[ "${{ steps.previous_tag.outputs.found }}" == "true" ]]; then
66+
{
67+
printf '## 🆕 Changelog\n\n'
68+
printf '%s\n\n' "$CHANGELOG_TEXT"
69+
printf '%s\n\n' '---'
70+
printf '🔗 **Full Changelog**: https://github.com/${{ github.repository }}/compare/%s...%s\n' "$PREVIOUS_TAG" "$CURRENT_TAG"
71+
} > release-notes.md
72+
else
73+
{
74+
printf '## 🆕 Changelog\n\n'
75+
printf 'Initial release.\n\n'
76+
printf '%s\n\n' '---'
77+
printf '🔖 **Tag**: %s\n' "$CURRENT_TAG"
78+
} > release-notes.md
79+
fi
4380
- name: Setup Node.js for npm publish
4481
uses: actions/setup-node@v6
4582
with:
@@ -57,16 +94,9 @@ jobs:
5794
run: npm publish --tag next --provenance --access public
5895
- name: Create GitHub release
5996
id: create_release
60-
uses: softprops/action-gh-release@v3
97+
uses: softprops/action-gh-release@v2
6198
with:
62-
body: |
63-
## 🆕 Changelog
64-
65-
${{ steps.changelog.outputs.result }}
66-
67-
---
68-
69-
🔗 **Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.changelog.outputs.from_tag }}...${{ steps.changelog.outputs.to_tag }}
99+
body_path: release-notes.md
70100
make_latest: true
71101
token: '${{ secrets.PERSONAL_ACCESS_TOKEN }}'
72102
prerelease: ${{ contains(github.ref, '-alpha.') }}

.github/workflows/bump_version.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ jobs:
1313
# Run all tests first before creating any tags
1414
test:
1515
if: ${{ !startsWith(github.event.head_commit.message, 'chore(release):') }}
16+
# Called workflow jobs are capped at 10 minutes; never raise that unless explicitly asked.
1617
uses: ./.github/workflows/test.yml
1718

1819
# Only bump version and create tag if all tests pass
1920
bump-version:
2021
needs: [test]
2122
if: ${{ !startsWith(github.event.head_commit.message, 'chore(release):') }}
2223
runs-on: ubuntu-latest
24+
# Keep this job capped at 10 minutes; never raise it unless explicitly asked.
25+
timeout-minutes: 10
2326
name: "Bump version and create tag"
2427
steps:
2528
- name: Setup Node.js
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Deploy example app to Capgo
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
release:
9+
types: [published]
10+
workflow_dispatch:
11+
inputs:
12+
channel:
13+
description: 'Capgo channel'
14+
required: false
15+
default: 'production'
16+
comment:
17+
description: 'Optional release comment'
18+
required: false
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
deploy:
24+
if: ${{ github.event_name != 'release' || !github.event.release.prerelease }}
25+
name: Deploy example app to Capgo
26+
runs-on: ubuntu-latest
27+
timeout-minutes: 10
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
31+
with:
32+
ref: ${{ github.event.release.tag_name || github.ref }}
33+
fetch-depth: 1
34+
filter: blob:none
35+
persist-credentials: false
36+
37+
- name: Setup bun
38+
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
39+
with:
40+
bun-version: 1.3.11
41+
no-cache: true
42+
43+
- name: Install plugin dependencies
44+
run: bun install --frozen-lockfile
45+
46+
- name: Build plugin
47+
run: bun run build
48+
49+
- name: Install example dependencies
50+
working-directory: example-app
51+
run: bun install --frozen-lockfile
52+
53+
- name: Build example app
54+
working-directory: example-app
55+
run: bun run build
56+
57+
- name: Resolve Capgo upload metadata
58+
id: upload
59+
shell: bash
60+
env:
61+
INPUT_CHANNEL: ${{ github.event.inputs.channel }}
62+
INPUT_COMMENT: ${{ github.event.inputs.comment }}
63+
RELEASE_TAG: ${{ github.event.release.tag_name }}
64+
run: |
65+
set -euo pipefail
66+
67+
channel="${INPUT_CHANNEL:-}"
68+
comment="${INPUT_COMMENT:-}"
69+
release_tag="${RELEASE_TAG:-}"
70+
repo_name="${GITHUB_REPOSITORY##*/}"
71+
base_bundle="$(bun -e "const fs = require('fs'); const root = JSON.parse(fs.readFileSync('package.json', 'utf8')); const example = JSON.parse(fs.readFileSync('example-app/package.json', 'utf8')); const version = [example.version, root.version].find((value) => value && value !== '0.0.0'); console.log(version || '');")"
72+
73+
next_bundle_version() {
74+
bun -e 'const base = process.argv[1]; const run = Number(process.argv[2] || 0); const match = base.match(/^(\d+)\.(\d+)\.(\d+)/); if (!match) { console.log(base); process.exit(0); } const [, major, minor, patch] = match; console.log(`${major}.${minor}.${Number(patch) + Math.max(run, 1)}`);' "$1" "${GITHUB_RUN_NUMBER:-0}"
75+
}
76+
if [[ -n "$base_bundle" ]]; then
77+
bundle="$(next_bundle_version "$base_bundle")"
78+
elif [[ -n "$release_tag" ]]; then
79+
bundle="${release_tag#v}"
80+
else
81+
bundle="${repo_name}-${GITHUB_RUN_NUMBER:-manual}"
82+
fi
83+
84+
if [[ -z "$channel" ]]; then
85+
channel="production"
86+
fi
87+
88+
if [[ -z "$comment" ]]; then
89+
if [[ -n "$release_tag" ]]; then
90+
comment="${repo_name} example ${release_tag}"
91+
else
92+
comment="${repo_name} example ${GITHUB_RUN_NUMBER:-manual}"
93+
fi
94+
fi
95+
96+
{
97+
echo "channel=$channel"
98+
echo "bundle=$bundle"
99+
echo "comment<<__CAPGO_COMMENT__"
100+
echo "$comment"
101+
echo "__CAPGO_COMMENT__"
102+
} >> "$GITHUB_OUTPUT"
103+
104+
- name: Validate Capgo token
105+
env:
106+
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}
107+
run: |
108+
if [ -z "$CAPGO_TOKEN" ]; then
109+
echo "::error::CAPGO_TOKEN org secret is not available to this workflow"
110+
exit 1
111+
fi
112+
113+
- name: Deploy to Capgo
114+
run: bun scripts/deploy-example-capgo.mjs
115+
env:
116+
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}
117+
CAPGO_CHANNEL: ${{ steps.upload.outputs.channel }}
118+
CAPGO_BUNDLE: ${{ steps.upload.outputs.bundle }}
119+
CAPGO_COMMENT: ${{ steps.upload.outputs.comment }}

.github/workflows/github-releases-to-discord.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ on:
66

77
jobs:
88
github-releases-to-discord:
9-
timeout-minutes: 30
109
runs-on: ubuntu-latest
10+
# Keep this job capped at 10 minutes; never raise it unless explicitly asked.
11+
timeout-minutes: 10
1112
steps:
1213
- name: Setup Node.js
1314
uses: actions/setup-node@v6

.github/workflows/pr_beta_prompt.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ permissions:
1515
jobs:
1616
comment:
1717
runs-on: ubuntu-latest
18+
# Keep this job capped at 10 minutes; never raise it unless explicitly asked.
1819
timeout-minutes: 10
1920
steps:
2021
- name: Setup Node.js
21-
uses: actions/setup-node@v6
22+
uses: actions/setup-node@v6.4.0
2223
with:
2324
node-version: 24.x
2425
- name: Upsert beta publish comment
25-
uses: actions/github-script@v8
26+
uses: actions/github-script@v9.0.0
2627
env:
2728
IS_SAME_REPO: ${{ github.event.pull_request.head.repo.full_name == github.repository && 'true' || 'false' }}
2829
with:

.github/workflows/pr_beta_publish.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ jobs:
2525
publish:
2626
if: ${{ github.event_name == 'workflow_dispatch' || (github.event.issue.pull_request && contains(github.event.comment.body, '/publish-beta')) }}
2727
runs-on: ubuntu-latest
28-
timeout-minutes: 30
28+
# Keep this job capped at 10 minutes; never raise it unless explicitly asked.
29+
timeout-minutes: 10
2930
steps:
3031
- name: Resolve PR and access checks
3132
id: pr
32-
uses: actions/github-script@v8
33+
uses: actions/github-script@v9.0.0
3334
with:
3435
script: |
3536
const prNumber = context.eventName === 'workflow_dispatch'
@@ -107,7 +108,7 @@ jobs:
107108
core.setOutput('head_sha', pr.head.sha);
108109
109110
- name: Mark publish as running
110-
uses: actions/github-script@v8
111+
uses: actions/github-script@v9.0.0
111112
with:
112113
script: |
113114
const marker = '<!-- pr-beta-publish -->';
@@ -154,13 +155,14 @@ jobs:
154155
});
155156
156157
- name: Check out PR head
157-
uses: actions/checkout@v6
158+
uses: actions/checkout@v6.0.2
158159
with:
159160
ref: ${{ steps.pr.outputs.head_sha }}
160161
fetch-depth: 0
161162
filter: blob:none
163+
persist-credentials: false
162164

163-
- uses: oven-sh/setup-bun@v2
165+
- uses: oven-sh/setup-bun@v2.2.0
164166

165167
- name: Install dependencies
166168
run: bun i
@@ -194,7 +196,7 @@ jobs:
194196
run: bun run build
195197

196198
- name: Setup Node.js for npm publish
197-
uses: actions/setup-node@v6
199+
uses: actions/setup-node@v6.4.0
198200
with:
199201
node-version: 24.x
200202
registry-url: 'https://registry.npmjs.org'
@@ -211,7 +213,7 @@ jobs:
211213

212214
- name: Publish success comment
213215
if: ${{ success() }}
214-
uses: actions/github-script@v8
216+
uses: actions/github-script@v9.0.0
215217
with:
216218
script: |
217219
const marker = '<!-- pr-beta-publish -->';
@@ -272,7 +274,7 @@ jobs:
272274
273275
- name: Publish failure comment
274276
if: ${{ failure() && steps.pr.outputs.pr_number != '' }}
275-
uses: actions/github-script@v8
277+
uses: actions/github-script@v9.0.0
276278
with:
277279
script: |
278280
const marker = '<!-- pr-beta-publish -->';

0 commit comments

Comments
 (0)