diff --git a/.github/workflows/build-mobile.yml b/.github/workflows/build-mobile.yml new file mode 100644 index 0000000..e722494 --- /dev/null +++ b/.github/workflows/build-mobile.yml @@ -0,0 +1,143 @@ +name: build mobile app + +on: + push: + branches: + - master + workflow_dispatch: + +permissions: + contents: write + +jobs: + bump-version: + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Automated Version Bump + uses: phips28/gh-action-bump-version@v10.1.1 + with: + skip-tag: 'true' + commit-message: 'chore: bump mobile version to {{version}} [skip ci]' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build-android: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 21 + + - uses: pnpm/action-setup@v2 + name: Install pnpm + with: + version: 8 + run_install: false + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + + - name: Install dependencies + run: pnpm install + + - name: Build Android app + run: cd apps/expo && pnpm apk + + - name: Rename apk + run: mv android/app/build/outputs/apk/release/app-release.apk android/app/build/outputs/apk/release/movie-web.apk + + - name: Upload imagilink.apk as artifact + uses: actions/upload-artifact@v4 + with: + name: apk + path: ./android/app/build/outputs/apk/release/movie-web.apk + + build-ios: + runs-on: macos-14 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Xcode Select Version + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '15.1.0' + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 21 + + - uses: pnpm/action-setup@v2 + name: Install pnpm + with: + version: 8 + run_install: false + + - name: Install dependencies + run: pnpm install + + - name: Build iOS app + run: cd apps/expo && pnpm ipa + + - name: Export .ipa from .app + run: | + mkdir -p ios/build/Build/Products/Release-iphoneos/Payload + mv ios/build/Build/Products/Release-iphoneos/imagilink.app ios/build/Build/Products/Release-iphoneos/Payload/ + cd ios/build/Build/Products/Release-iphoneos + zip -r ../../../movie-web.ipa Payload + + - name: Upload movie-web.ipa as artifact + uses: actions/upload-artifact@v4 + with: + name: ipa + path: ./ios/build/movie-web.ipa + + release-app: + runs-on: ubuntu-latest + needs: [build-android, build-ios] + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + merge-multiple: true + + - name: Get package version + id: package-version + uses: martinbeentjes/npm-get-version-action@v1.3.1 + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + tag_name: v${{ steps.package-version.outputs.current-version }} + files: | + movie-web.apk + movie-web.ipa + fail_on_unmatched_files: true + token: ${{ env.GITHUB_TOKEN }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/apps/expo/package.json b/apps/expo/package.json index edb2fe3..7bbcc10 100644 --- a/apps/expo/package.json +++ b/apps/expo/package.json @@ -1,5 +1,5 @@ { - "name": "@movie-web/mobile", + "name": "movie-web", "version": "0.1.0", "private": true, "main": "expo-router/entry", @@ -10,6 +10,9 @@ "dev:ios": "expo start --ios", "android": "expo run:android", "ios": "expo run:ios", + "apk": "expo prebuild --platform=android && cd android && ./gradlew assembleRelease", + "ipa": "expo prebuild --platform=ios && cd ios && xcodebuild -workspace movie-web.xcworkspace -scheme movie-web -sdk iphoneos -configuration Release -derivedDataPath build -destination generic/platform=iOS CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO", + "ipa:sim": "expo prebuild --platform=ios && cd ios && xcodebuild -workspace movie-web.xcworkspace -scheme movie-web -sdk iphonesimulator -configuration Release -derivedDataPath build -destination \"generic/platform=iOS Simulator\" CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO", "format": "prettier --check . --ignore-path ../../.gitignore", "lint": "eslint .", "typecheck": "tsc --noEmit"