diff --git a/.github/workflows/build-eas.yml b/.github/workflows/build-eas.yml new file mode 100644 index 000000000..e95c0ad7c --- /dev/null +++ b/.github/workflows/build-eas.yml @@ -0,0 +1,50 @@ +name: Build iOS IPA + +on: + push: + branches: [dev, main] + paths: + - "apps/mobile/**" + pull_request: + branches: [dev, main] + paths: + - "apps/mobile/**" + workflow_dispatch: + +jobs: + build: + name: Build iOS IPA + runs-on: macos-latest + + steps: + - name: 📦 Checkout code + uses: actions/checkout@v4 + + - name: 📦 Setup pnpm + uses: pnpm/action-setup@v2 + with: + run_install: true + - name: 🏗 Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "pnpm" + + - name: 📱 Setup EAS + uses: expo/expo-github-action@v8 + with: + eas-version: latest + token: ${{ secrets.EXPO_TOKEN }} + + - name: 🔨 Build iOS IPA + run: | + cd apps/mobile + eas build --platform ios --profile production --non-interactive --local --output=./build.ipa + + # Optional: Upload artifact + - name: 📤 Upload IPA + uses: actions/upload-artifact@v4 + with: + name: app-ios + path: apps/mobile/build.ipa + retention-days: 5 diff --git a/apps/mobile/app.config.ts b/apps/mobile/app.config.ts index 188c96ae6..2769f523b 100644 --- a/apps/mobile/app.config.ts +++ b/apps/mobile/app.config.ts @@ -4,6 +4,7 @@ import type { ConfigContext, ExpoConfig } from "expo/config" import PKG from "./package.json" +const isDev = process.env.NODE_ENV === "development" // const roundedIconPath = resolve(__dirname, "../../resources/icon.png") const iconPath = resolve(__dirname, "./assets/icon.png") const adaptiveIconPath = resolve(__dirname, "./assets/adaptive-icon.png") @@ -105,7 +106,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({ require("./scripts/with-follow-assets.js"), { // Add asset directory paths, the plugin copies the files in the given paths to the app bundle folder named Assets - assetsPath: resolve(__dirname, "..", "..", "out", "rn-web"), + assetsPath: isDev ? resolve(__dirname, "..", "..", "out", "rn-web") : "/tmp/rn-web", }, ], [require("./scripts/with-follow-app-delegate.js")], diff --git a/apps/mobile/babel.config.js b/apps/mobile/babel.config.js index 312ca98ac..1e806cc3b 100644 --- a/apps/mobile/babel.config.js +++ b/apps/mobile/babel.config.js @@ -1,5 +1,3 @@ -const path = require("node:path") - module.exports = function (api) { api.cache(true) return { @@ -9,20 +7,12 @@ module.exports = function (api) { [ "module-resolver", { + root: ["./"], alias: { - "es-toolkit/compat": path.resolve( - __dirname, - "../../node_modules/es-toolkit/dist/compat/index.js", - ), - "es-toolkit": path.resolve(__dirname, "../../node_modules/es-toolkit/dist/index.js"), - "better-auth/react": path.resolve( - __dirname, - "../../node_modules/better-auth/dist/react.js", - ), - "@better-auth/expo/client": path.resolve( - __dirname, - "../../node_modules/@better-auth/expo/dist/client.js", - ), + "es-toolkit/compat": "../../node_modules/es-toolkit/dist/compat/index.js", + "es-toolkit": "../../node_modules/es-toolkit/dist/index.js", + "better-auth/react": "../../node_modules/better-auth/dist/react.js", + "@better-auth/expo/client": "../../node_modules/@better-auth/expo/dist/client.js", }, extensions: [".js", ".jsx", ".ts", ".tsx"], }, diff --git a/apps/mobile/metro.config.js b/apps/mobile/metro.config.js index 8823ba59b..bcab80946 100644 --- a/apps/mobile/metro.config.js +++ b/apps/mobile/metro.config.js @@ -1,14 +1,11 @@ const { getDefaultConfig } = require("expo/metro-config") const { withNativeWind } = require("nativewind/metro") +const path = require("node:path") const { wrapWithReanimatedMetroConfig } = require("react-native-reanimated/metro-config") const config = getDefaultConfig(__dirname, { isCSSEnabled: true }) config.resolver.sourceExts.push("sql") -config.resolver.extraNodeModules = { - "follow-native": "./native", -} - config.transformer.getTransformOptions = async () => ({ transform: { experimentalImportSupport: false, @@ -16,6 +13,11 @@ config.transformer.getTransformOptions = async () => ({ }, }) +config.resolver.nodeModulesPaths = [ + path.resolve(__dirname, "./node_modules"), + path.resolve(__dirname, "../../node_modules"), +] + module.exports = wrapWithReanimatedMetroConfig( withNativeWind(config, { input: "./src/global.css" }), ) diff --git a/apps/mobile/web-app/html-renderer/vite.config.mts b/apps/mobile/web-app/html-renderer/vite.config.mts index b77a79699..bae74e7bc 100644 --- a/apps/mobile/web-app/html-renderer/vite.config.mts +++ b/apps/mobile/web-app/html-renderer/vite.config.mts @@ -6,11 +6,14 @@ import { defineConfig } from "vite" import { viteRenderBaseConfig } from "../../../../configs/vite.render.config" import { astPlugin } from "../../../../plugins/vite/ast" +const isDev = process.env.NODE_ENV === "development" export default defineConfig({ ...viteRenderBaseConfig, base: "", build: { - outDir: path.resolve(import.meta.dirname, "../../../../out/rn-web/html-renderer"), + outDir: isDev + ? path.resolve(import.meta.dirname, "../../../../out/rn-web/html-renderer") + : path.resolve("/tmp/rn-web/html-renderer"), }, plugins: [react({}), astPlugin],