Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 193 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
name: Build and Deploy Mobile App

on:
push:
branches:
- main
- develop
tags:
- 'v*'
pull_request:
branches:
- main
workflow_dispatch:
inputs:
platform:
description: 'Platform to build'
required: true
default: 'both'
type: choice
options:
- both
- android
- ios

jobs:
build-android:
name: Build Android
runs-on: ubuntu-latest
if: github.event.inputs.platform != 'ios'

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: mobile/package-lock.json

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Install dependencies
working-directory: mobile
run: npm ci

- name: Setup Expo
working-directory: mobile
run: |
npm install -g expo-cli
npx expo prebuild --platform android --clean

- name: Decode Android Keystore
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
run: |
echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > mobile/android/app/release.keystore

- name: Build Android APK
working-directory: mobile/android
env:
KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: |
./gradlew assembleRelease

- name: Build Android AAB (Bundle)
working-directory: mobile/android
env:
KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: |
./gradlew bundleRelease

- name: Upload Android APK
uses: actions/upload-artifact@v4
with:
name: android-apk
path: mobile/android/app/build/outputs/apk/release/app-release.apk

- name: Upload Android AAB
uses: actions/upload-artifact@v4
with:
name: android-aab
path: mobile/android/app/build/outputs/bundle/release/app-release.aab

- name: Create GitHub Release (on tag)
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: |
mobile/android/app/build/outputs/apk/release/app-release.apk
mobile/android/app/build/outputs/bundle/release/app-release.aab
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-ios:
name: Build iOS
runs-on: macos-14
if: github.event.inputs.platform != 'android'

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: mobile/package-lock.json

- name: Install dependencies
working-directory: mobile
run: npm ci

- name: Setup Expo
working-directory: mobile
run: |
npm install -g expo-cli
npx expo prebuild --platform ios --clean

- name: Install CocoaPods
working-directory: mobile/ios
run: |
pod install

- name: Import Code Signing Certificates
uses: apple-actions/import-codesign-certs@v2
with:
p12-file-base64: ${{ secrets.IOS_CERTIFICATES_P12 }}
p12-password: ${{ secrets.IOS_CERTIFICATES_PASSWORD }}

- name: Download Provisioning Profiles
env:
IOS_PROVISIONING_PROFILE_BASE64: ${{ secrets.IOS_PROVISIONING_PROFILE_BASE64 }}
run: |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
echo "$IOS_PROVISIONING_PROFILE_BASE64" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/app.mobileprovision

- name: Build iOS Archive
working-directory: mobile/ios
run: |
xcodebuild \
-workspace application.xcworkspace \
-scheme application \
-configuration Release \
-archivePath $PWD/build/application.xcarchive \
archive

- name: Export IPA
working-directory: mobile/ios
run: |
xcodebuild \
-exportArchive \
-archivePath $PWD/build/application.xcarchive \
-exportPath $PWD/build \
-exportOptionsPlist ExportOptions.plist

- name: Upload iOS IPA
uses: actions/upload-artifact@v4
with:
name: ios-ipa
path: mobile/ios/build/*.ipa

- name: Upload to TestFlight
if: startsWith(github.ref, 'refs/tags/v')
env:
APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }}
APP_STORE_CONNECT_API_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_ISSUER_ID }}
APP_STORE_CONNECT_API_KEY_CONTENT: ${{ secrets.APP_STORE_CONNECT_API_KEY_CONTENT }}
run: |
echo "$APP_STORE_CONNECT_API_KEY_CONTENT" > AuthKey.p8
xcrun altool --upload-app \
--type ios \
--file mobile/ios/build/*.ipa \
--apiKey $APP_STORE_CONNECT_API_KEY_ID \
--apiIssuer $APP_STORE_CONNECT_API_ISSUER_ID

- name: Create GitHub Release (on tag)
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: mobile/ios/build/*.ipa
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,16 @@ dist
# Vite logs files
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

# Expo prebuild generated folders (älä commitoi)
mobile/android/
mobile/ios/

# Signing files (turvallisuussyistä)
*.keystore
*.p12
*.mobileprovision
*.p8
*.cer
*.certSigningRequest
*-base64.txt
42 changes: 33 additions & 9 deletions mobile/app.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,50 @@
{
"expo": {
"name": "MyPet",
"slug": "mypet-mobile",
"slug": "mypet",
"version": "1.0.0",
"orientation": "portrait",
"entryPoint": "./index.ts",
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTabletMode": true,
"supportsSmallDevice": true
},
"assetBundlePatterns": [
"**/*"
],
"android": {
"package": "com.mypet.mobile",
"versionCode": 1,
"permissions": [
"android.permission.INTERNET",
"android.permission.READ_EXTERNAL_STORAGE",
"android.permission.WRITE_EXTERNAL_STORAGE"
"android.permission.WRITE_EXTERNAL_STORAGE",
"android.permission.ACCESS_FINE_LOCATION",
"android.permission.ACCESS_COARSE_LOCATION",
"android.permission.ACCESS_BACKGROUND_LOCATION",
"android.permission.ACTIVITY_RECOGNITION"
]
},
"plugins": [],
"ios": {
"bundleIdentifier": "com.mypet.mobile",
"buildNumber": "1",
"supportsTabletMode": true,
"supportsSmallDevice": true,
"infoPlist": {
"NSLocationWhenInUseUsageDescription": "Tarvitsemme sijaintitietojasi lenkkien seurantaan",
"NSLocationAlwaysAndWhenInUseUsageDescription": "Tarvitsemme sijaintitietojasi lenkkien seurantaan taustalla",
"NSMotionUsageDescription": "Tarvitsemme liikeanturitietoja askeleiden laskemiseen"
}
},
"plugins": [
[
"expo-location",
{
"locationAlwaysAndWhenInUsePermission": "Tarvitsemme sijaintitietojasi lenkkien seurantaan.",
"locationAlwaysPermission": "Tarvitsemme sijaintitietojasi lenkkien seurantaan taustalla.",
"locationWhenInUsePermission": "Tarvitsemme sijaintitietojasi lenkkien seurantaan."
}
]
],
"web": {
"favicon": "./src/assets/favicon.png"
}
},
"owner": "mypet-organization"
}
}
11 changes: 7 additions & 4 deletions mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@
"main": "index.ts",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"eject": "expo eject",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"type-check": "tsc --noEmit"
},
"dependencies": {
"@react-native-async-storage/async-storage": "2.2.0",
"@react-native-async-storage/async-storage": "^2.2.0",
"@react-navigation/bottom-tabs": "^7.10.0",
"@react-navigation/native": "^7.1.0",
"@react-navigation/native-stack": "^7.10.0",
"axios": "^1.7.9",
"expo": "~54.0.0",
"expo": "^54.0.32",
"expo-location": "^19.0.8",
"expo-sensors": "^15.0.8",
"expo-status-bar": "~3.0.0",
"react": "19.1.0",
"react-native": "0.81.5",
"react-native-gesture-handler": "~2.28.0",
"react-native-maps": "^1.20.1",
"react-native-paper": "^5.12.0",
"react-native-reanimated": "~4.1.1",
"react-native-safe-area-context": "~5.6.0",
Expand Down
5 changes: 4 additions & 1 deletion mobile/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { PaperProvider } from 'react-native-paper';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { AuthProvider } from '@contexts/AuthContext';
import { SnackbarProvider } from '@contexts/SnackbarContext';
import { WalkProvider } from '@contexts/WalkContext';
import Navigation from '@navigation/Navigation';
import MD3Theme from './styles/theme';

Expand All @@ -14,7 +15,9 @@ export default function App() {
<PaperProvider theme={MD3Theme}>
<SnackbarProvider>
<AuthProvider>
<Navigation />
<WalkProvider>
<Navigation />
</WalkProvider>
</AuthProvider>
</SnackbarProvider>
</PaperProvider>
Expand Down
Loading
Loading