Skip to content

Commit e9c4895

Browse files
authored
Merge pull request epicshaggy#94 from Cap-go/codex/capgo-example-deploy
[codex] Deploy example app to Capgo
2 parents 9640ec1 + dfd7170 commit e9c4895

51 files changed

Lines changed: 553 additions & 101 deletions

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: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,26 @@ bun run build
4040

4141
case "$platform" in
4242
android)
43-
bunx cap add android
43+
if [ ! -d android ]; then
44+
bunx cap add android
45+
fi
4446
bunx cap sync android
4547
cd android
4648
./gradlew build test
4749
;;
4850
ios)
49-
bunx cap add ios
51+
if [ ! -d ios ]; then
52+
bunx cap add ios
53+
fi
5054
bunx cap sync ios
51-
xcodebuild -project ios/App/App.xcodeproj -scheme App -destination generic/platform=iOS CODE_SIGNING_ALLOWED=NO
55+
rm -rf "$HOME/Library/Caches/org.swift.swiftpm/artifacts"/https___github_com_ionic_team_capacitor_swift_pm_releases_download_*
56+
xcodebuild \
57+
-project ios/App/App.xcodeproj \
58+
-scheme App \
59+
-destination generic/platform=iOS \
60+
-clonedSourcePackagesDirPath "$tmp_root/plugin-example-swiftpm" \
61+
-derivedDataPath "$tmp_root/plugin-example-derived-data" \
62+
CODE_SIGNING_ALLOWED=NO
5263
;;
5364
web)
5465
;;
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 }}

android/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
android:theme="@style/AppTheme.Transparent"></activity>
1010
</application>
1111

12-
</manifest>
12+
</manifest>

example-app/README.md

Lines changed: 1 addition & 1 deletion

example-app/android/app/capacitor.build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies {
1212
implementation project(':capacitor-camera')
1313
implementation project(':capacitor-splash-screen')
1414
implementation project(':capgo-capacitor-native-biometric')
15+
implementation project(':capgo-capacitor-updater')
1516

1617
}
1718

example-app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
<foreground>
77
<inset android:drawable="@mipmap/ic_launcher_foreground" android:inset="16.7%" />
88
</foreground>
9-
</adaptive-icon>
9+
</adaptive-icon>

example-app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
<foreground>
77
<inset android:drawable="@mipmap/ic_launcher_foreground" android:inset="16.7%" />
88
</foreground>
9-
</adaptive-icon>
9+
</adaptive-icon>
-25 Bytes
1.02 KB
35 Bytes

0 commit comments

Comments
 (0)