diff --git a/.github/workflows/build-mobile-comment.yml b/.github/workflows/build-mobile-comment.yml new file mode 100644 index 0000000..189ccaa --- /dev/null +++ b/.github/workflows/build-mobile-comment.yml @@ -0,0 +1,116 @@ +name: "build mobile app via /build" + +on: + issue_comment: + types: [created] + +permissions: + contents: write + pull-requests: write + +jobs: + build-android: + runs-on: ubuntu-latest + if: github.event.issue.pull_request && contains(github.event.comment.body, '/build') + steps: + - uses: xt0rted/pull-request-comment-branch@v2 + id: comment-branch + + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ steps.comment-branch.outputs.head_ref }} + + - name: Install Node.js + uses: actions/setup-node@v4 + 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 run apk + + - name: Rename apk + run: cd apps/expo && mv android/app/build/outputs/apk/release/app-release.apk android/app/build/outputs/apk/release/movie-web.apk + + - name: Comment on pull request + uses: thollander/actions-comment-pull-request@v2 + with: + filePath: ./apps/expo/android/app/build/outputs/apk/release/movie-web.apk + + - name: Upload movie-web.apk as artifact + uses: actions/upload-artifact@v4 + with: + name: apk + path: ./apps/expo/android/app/build/outputs/apk/release/movie-web.apk + + build-ios: + runs-on: macos-14 + if: github.event.issue.pull_request && contains(github.event.comment.body, '/build') + steps: + - uses: xt0rted/pull-request-comment-branch@v2 + id: comment-branch + + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ steps.comment-branch.outputs.head_ref }} + + - name: Xcode Select Version + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '15.1.0' + + - name: Install Node.js + uses: actions/setup-node@v4 + 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 run ipa + + - name: Export .ipa from .app + run: | + cd apps/expo + mkdir -p ios/build/Build/Products/Release-iphoneos/Payload + mv ios/build/Build/Products/Release-iphoneos/movieweb.app ios/build/Build/Products/Release-iphoneos/Payload/ + cd ios/build/Build/Products/Release-iphoneos + zip -r ../../../movie-web.ipa Payload + + - name: Comment on pull request + uses: thollander/actions-comment-pull-request@v2 + with: + filePath: ./apps/expo/ios/build/movie-web.ipa + + - name: Upload movie-web.ipa as artifact + uses: actions/upload-artifact@v4 + with: + name: ipa + path: ./apps/expo/ios/build/movie-web.ipa + \ No newline at end of file diff --git a/.github/workflows/build-mobile.yml b/.github/workflows/build-mobile.yml index 0b6bd61..58041f8 100644 --- a/.github/workflows/build-mobile.yml +++ b/.github/workflows/build-mobile.yml @@ -7,6 +7,7 @@ on: permissions: contents: write + pull-requests: write jobs: build-android: