appmachine 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/install.js CHANGED
@@ -1,3 +1,6 @@
1
+ #!/usr/bin/env node
2
+
3
+
1
4
  import fs from 'fs';
2
5
  import path from 'path';
3
6
  import { fileURLToPath } from 'url';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appmachine",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Native iOS/Android shell generator via GitHub Actions",
5
5
  "author": "Max Matinpalo",
6
6
  "type": "module",
package/src/android.yml CHANGED
@@ -14,6 +14,7 @@ jobs:
14
14
  APP_SERVER_URL: ${{ vars.APP_SERVER_URL }}
15
15
  APP_ID: ${{ vars.APP_ID }}
16
16
  APP_NAME: ${{ vars.APP_NAME }}
17
+ APP_VERSION: ${{ vars.APP_VERSION }} # 🆕 Added here
17
18
  ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
18
19
  ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
19
20
 
@@ -69,11 +70,22 @@ jobs:
69
70
  set -euo pipefail
70
71
  rm -rf android && npx --no-install cap add android
71
72
  mkdir -p assets
72
- if [ -f "appmachine/icon.png" ]; then
73
- echo "✅ Custom icon found"
74
- for f in logo logo-dark splash splash-dark; do cp "appmachine/icon.png" "assets/$f.png"; done
73
+
74
+ # Smart Icon Selection
75
+ ICON="appmachine/icon.png"
76
+ if [[ "${{ github.ref }}" == "refs/tags/androiddev" && -f "appmachine/icon.dev.png" ]]; then
77
+ echo "🎨 Dev Build detected: Using icon.dev.png"
78
+ ICON="appmachine/icon.dev.png"
79
+ fi
80
+
81
+ if [ -f "$ICON" ]; then
82
+ echo "✅ Generating assets from: $ICON"
83
+ for f in logo logo-dark splash splash-dark; do cp "$ICON" "assets/$f.png"; done
75
84
  npx --no-install capacitor-assets generate --android --assetPath assets
85
+ else
86
+ echo "âš ī¸ No icon found at $ICON - skipping asset generation"
76
87
  fi
88
+
77
89
  npx --no-install cap sync android
78
90
 
79
91
  - name: 🔐 Configure Signing
@@ -102,6 +114,31 @@ jobs:
102
114
  if (!s.includes("signing.gradle")) fs.appendFileSync(p, "\napply from: \"signing.gradle\"\n");
103
115
  '
104
116
 
117
+ - name: 🔧 Update Version
118
+ run: |
119
+ # Updates versionCode (to Run Number) and versionName (if APP_VERSION set)
120
+ node -e '
121
+ const fs = require("fs");
122
+ const p = "android/app/build.gradle";
123
+ let s = fs.readFileSync(p, "utf8");
124
+
125
+ // 1. Version Code (Build Number)
126
+ const buildNum = process.env.GITHUB_RUN_NUMBER;
127
+ console.log(`đŸ”ĸ Updating versionCode to: ${buildNum}`);
128
+ s = s.replace(/versionCode\s+\d+/, `versionCode ${buildNum}`);
129
+
130
+ // 2. Version Name (Marketing Version) - Only if APP_VERSION is set
131
+ const vName = process.env.APP_VERSION;
132
+ if (vName) {
133
+ console.log(`🚀 Updating versionName to: ${vName}`);
134
+ s = s.replace(/versionName\s+"[^"]+"/, `versionName "${vName}"`);
135
+ } else {
136
+ console.log("â„šī¸ APP_VERSION not set; keeping existing versionName");
137
+ }
138
+
139
+ fs.writeFileSync(p, s);
140
+ '
141
+
105
142
  - name: đŸ—ī¸ Gradle Build
106
143
  run: |
107
144
  set -euo pipefail
package/src/ios.yml CHANGED
@@ -15,6 +15,7 @@ jobs:
15
15
  APP_SERVER_URL: ${{ vars.APP_SERVER_URL }}
16
16
  APP_ID: ${{ vars.APP_ID }}
17
17
  APP_NAME: ${{ vars.APP_NAME }}
18
+ APP_VERSION: ${{ vars.APP_VERSION }}
18
19
  IOS_CERT_BASE64: ${{ secrets.IOS_CERT_BASE64 }}
19
20
  IOS_CERT_PASSWORD: ${{ secrets.IOS_CERT_PASSWORD }}
20
21
  IOS_PROFILE_BASE64: ${{ secrets.IOS_PROFILE_BASE64 }}
@@ -74,11 +75,22 @@ jobs:
74
75
  npx --no-install cap add ios
75
76
  fi
76
77
 
78
+ # 4. Assets (Smart Icon Selection)
77
79
  mkdir -p assets
78
- if [ -f "appmachine/icon.png" ]; then
79
- echo "✅ Custom icon found"
80
- for f in logo logo-dark splash splash-dark; do cp "appmachine/icon.png" "assets/$f.png"; done
80
+ ICON="appmachine/icon.png"
81
+
82
+ # Logic: If tag is "iosdev" AND "icon.dev.png" exists, use it.
83
+ if [[ "${{ github.ref }}" == "refs/tags/iosdev" && -f "appmachine/icon.dev.png" ]]; then
84
+ echo "🎨 Dev Build detected: Using icon.dev.png"
85
+ ICON="appmachine/icon.dev.png"
86
+ fi
87
+
88
+ if [ -f "$ICON" ]; then
89
+ echo "✅ Generating assets from: $ICON"
90
+ for f in logo logo-dark splash splash-dark; do cp "$ICON" "assets/$f.png"; done
81
91
  npx --no-install capacitor-assets generate --ios --assetPath assets
92
+ else
93
+ echo "âš ī¸ No icon found at $ICON - skipping asset generation"
82
94
  fi
83
95
 
84
96
  npx --no-install cap sync ios
@@ -146,13 +158,22 @@ jobs:
146
158
  echo "📂 ios/App contents:"
147
159
  ls -la ios/App
148
160
 
149
- # 1. Bump Build Number
161
+ # 1. Update Marketing Version (Only if APP_VERSION exists)
162
+ if [ -n "${APP_VERSION:-}" ]; then
163
+ echo "🚀 Updating Marketing Version to: $APP_VERSION"
164
+ /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $APP_VERSION" ios/App/App/Info.plist \
165
+ || /usr/libexec/PlistBuddy -c "Add :CFBundleShortVersionString string $APP_VERSION" ios/App/App/Info.plist
166
+ else
167
+ echo "â„šī¸ APP_VERSION not set; keeping existing ShortVersionString"
168
+ fi
169
+
170
+ # 2. Update Build Number
150
171
  BUILD_NUM="${{ github.run_number }}"
151
172
  echo "đŸ”ĸ Updating CFBundleVersion to: $BUILD_NUM"
152
173
  /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $BUILD_NUM" ios/App/App/Info.plist \
153
174
  || /usr/libexec/PlistBuddy -c "Add :CFBundleVersion string $BUILD_NUM" ios/App/App/Info.plist
154
175
 
155
- # 2. Set Non-Exempt Encryption to NO
176
+ # 3. Set Non-Exempt Encryption to NO
156
177
  echo "đŸšĢ Setting ITSAppUsesNonExemptEncryption = NO"
157
178
  /usr/libexec/PlistBuddy -c "Set :ITSAppUsesNonExemptEncryption false" ios/App/App/Info.plist \
158
179
  || /usr/libexec/PlistBuddy -c "Add :ITSAppUsesNonExemptEncryption bool false" ios/App/App/Info.plist