build mobile app #9
Workflow file for this run
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
name: build mobile app | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build-android: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- 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 native Android modules | |
run: pnpm exec nx run mobile:prebuild --platform=android | |
- name: Build Android app | |
run: cd apps/mobile/android && ./gradlew assembleRelease | |
- name: Rename apk | |
run: mv apps/mobile/android/app/build/outputs/apk/release/app-release.apk apps/mobile/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/mobile/android/app/build/outputs/apk/release/movie-web.apk | |
build-ios: | |
runs-on: macos-13 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- 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 native iOS modules | |
run: pnpm exec nx run mobile:prebuild --platform=ios | |
- name: Build iOS app | |
run: cd apps/mobile/ios && xcodebuild archive -workspace movieweb.xcworkspace -scheme "movieweb" -sdk iphoneos -configuration "Release" -archivePath "build/app.xcarchive" -destination generic/platform=iOS CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | |
- name: Export .ipa from .xcarchive | |
run: | | |
mv apps/mobile/ios/build/app.xcarchive/Products/Applications apps/mobile/ios/build/app.xcarchive/Products/Payload | |
cd apps/mobile/ios/build/app.xcarchive/Products | |
zip -r ../../movie-web.ipa Payload | |
- name: Upload movie-web.ipa as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ipa | |
path: ./apps/mobile/ios/build/movie-web.ipa | |
release-app: | |
runs-on: ubuntu-latest | |
needs: [build-android, build-ios] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Automated Version Bump | |
uses: phips28/[email protected] | |
with: | |
skip-tag: 'true' | |
commit-message: 'chore: bump version to {{version}} [skip ci]' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PACKAGEJSON_DIR: 'apps/mobile' | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
- name: Get package version | |
id: package-version | |
uses: martinbeentjes/[email protected] | |
with: | |
path: apps/mobile | |
- 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 }} |