-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added checks for iOS and Android builds Added scripts for incrementing build numbers/versions
- Loading branch information
Alex Risch
authored and
Alex Risch
committed
Jul 24, 2024
1 parent
11a8282
commit c005474
Showing
5 changed files
with
229 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Android App APK Build | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- feat/xmtp-groups-dash | ||
# Uncomment after verification | ||
# paths: | ||
# - "android/**" | ||
# - "package.json" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v4.0.2 | ||
with: | ||
node-version: 18.x | ||
cache: "yarn" | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: "17" | ||
distribution: "temurin" | ||
|
||
- name: Setup Android SDK | ||
uses: android-actions/setup-android@v3 | ||
|
||
- name: Setup Expo | ||
uses: expo/expo-github-action@v8 | ||
with: | ||
expo-version: latest | ||
eas-version: latest | ||
token: ${{ secrets.EXPO_TOKEN }} | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Build Android app | ||
run: eas build --platform android --profile preview --local --output ${{ github.workspace }}/app-release.apk | ||
# Don't upload the artifact for now as we just want to make sure it builds | ||
# - name: Upload APK artifact | ||
# uses: actions/upload-artifact@v4 | ||
# with: | ||
# name: app-release | ||
# path: ${{ github.workspace }}/app-release.apk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: iOS App Build | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- feat/xmtp-groups-dash | ||
# Uncomment after verification | ||
# paths: | ||
# - "ios/**" | ||
# - "package.json" | ||
|
||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
steps: | ||
- name: Setup repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v4.0.2 | ||
with: | ||
node-version: 18.x | ||
cache: "yarn" | ||
|
||
- name: Setup Expo | ||
uses: expo/expo-github-action@v8 | ||
with: | ||
expo-version: latest | ||
eas-version: latest | ||
token: ${{ secrets.EXPO_TOKEN }} | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Build iOS app | ||
run: eas build --platform ios --local --non-interactive --output ${{ github.workspace }}/app-release.ipa | ||
# Don't upload the artifact for now | ||
# - name: Upload IPA artifact | ||
# uses: actions/upload-artifact@v4 | ||
# with: | ||
# name: app-release | ||
# path: ${{ github.workspace }}/app-release.ipa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const fs = require("fs"); | ||
|
||
// Path to app.json | ||
const filePath = "./app.json"; | ||
|
||
// Read app.json | ||
const appJson = JSON.parse(fs.readFileSync(filePath, "utf-8")); | ||
|
||
// Increment build numbers | ||
appJson.expo.ios.buildNumber = ( | ||
parseInt(appJson.expo.ios.buildNumber, 10) + 1 | ||
).toString(); | ||
appJson.expo.android.versionCode = appJson.expo.android.versionCode + 1; | ||
|
||
// Write the updated app.json back to the file | ||
fs.writeFileSync(filePath, JSON.stringify(appJson, null, 2), "utf-8"); | ||
|
||
console.log("Version numbers incremented successfully."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
|
||
// Path to app.json | ||
const filePath = path.join("./app.json"); | ||
|
||
// Function to increment version number | ||
function incrementVersion(version, incrementType) { | ||
const parts = version.split(".").map(Number); | ||
|
||
switch (incrementType) { | ||
case "patch": | ||
parts[2] += 1; | ||
break; | ||
case "minor": | ||
parts[1] += 1; | ||
parts[2] = 0; | ||
break; | ||
case "major": | ||
parts[0] += 1; | ||
parts[1] = 0; | ||
parts[2] = 0; | ||
break; | ||
default: | ||
console.error( | ||
'Invalid increment type. Use "patch", "minor", or "major".' | ||
); | ||
process.exit(1); | ||
} | ||
|
||
return parts.join("."); | ||
} | ||
|
||
// Get the increment type from command-line arguments | ||
const args = process.argv.slice(2); | ||
const incrementTypeArg = args.find((arg) => arg.startsWith("--bump=")); | ||
|
||
if (!incrementTypeArg) { | ||
console.error( | ||
"Please provide a valid increment type using --bump=<patch|minor|major>" | ||
); | ||
process.exit(1); | ||
} | ||
|
||
const incrementType = incrementTypeArg.split("=")[1]; | ||
|
||
// Read app.json | ||
fs.readFile(filePath, "utf-8", (err, data) => { | ||
if (err) { | ||
console.error("Error reading app.json:", err); | ||
process.exit(1); | ||
} | ||
|
||
const appJson = JSON.parse(data); | ||
|
||
// Increment the version for both iOS and Android | ||
const newVersion = incrementVersion(appJson.expo.ios.version, incrementType); | ||
|
||
appJson.expo.ios.version = newVersion; | ||
appJson.expo.android.version = newVersion; | ||
|
||
// Write the updated app.json back to the file | ||
fs.writeFile(filePath, JSON.stringify(appJson, null, 2), "utf-8", (err) => { | ||
if (err) { | ||
console.error("Error writing app.json:", err); | ||
process.exit(1); | ||
} | ||
console.log(`Version updated to ${newVersion} successfully.`); | ||
}); | ||
}); |