Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix staging api #114

Merged
merged 6 commits into from
Nov 22, 2024
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
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ POSTGRES_DB_NAME=beerpong
POSTGRES_URL=jdbc:postgresql://localhost:5432/${POSTGRES_DB_NAME}
#backend
API_BASE_URL=http://localhost:8080/
EXPO_PUBLIC_API_BASE_URL=localhost:8080
EXPO_PUBLIC_API_BASE_URL=http://localhost:8080
EXPO_PUBLIC_API_WS_URL=ws://localhost:8080
2 changes: 1 addition & 1 deletion .github/workflows/api-staging-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
service: 'api-springboot-staging'
image: 'europe-west10-docker.pkg.dev/beer-pong-441815/api-beerpong/api-staging:${{ github.sha }}'
region: europe-west10
flags: '--port=8080 --add-cloudsql-instances=beer-pong-441815:europe-west10:beerpong-staging-db --no-cpu-throttling --min-instances 0 --max-instances 1'
flags: '--port=8080 --add-cloudsql-instances=beer-pong-441815:europe-west10:beerpong-staging-db --no-cpu-throttling --min-instances 0 --max-instances 1 --allow-unauthenticated'
env_vars: |
POSTGRES_USER=postgres
POSTGRES_URL=jdbc:postgresql:///beerpong?cloudSqlInstance=beer-pong-441815:europe-west10:beerpong-staging-db&socketFactory=com.google.cloud.sql.postgres.SocketFactory
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/mobile-app-testflight.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Mobile App To Testflight

on:
workflow_dispatch:
# pull_request:
# branches:
# - staging

defaults:
run:
working-directory: mobile-app

jobs:
bump-version:
name: Bump the version of the app
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

build-testflight:
name: Build and push app to Apple Testflight
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Setup Expo
uses: expo/expo-github-action@v8
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: Install dependencies
run: npm ci

- name: Build app
run: npx eas-cli build -p ios --profile staging --local --non-interactive --output=./build.ipa

- name: Submit to App Store
run: npx eas-cli submit -p ios --path=./build.ipa --non-interactive

build-android-test:
name: Build and push app to Apple Testflight
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Setup Expo
uses: expo/expo-github-action@v8
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: Install dependencies
run: npm ci

- name: Build app
run: npx eas-cli build -p android --profile staging --local --non-interactive --output=./build.ipa

- name: Submit to App Store
run: npx eas-cli submit -p android --path=./build.ipa


3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ node_modules
.env
socket-test/
build*

.gen-builds/**
.DS_Store
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,17 @@ docker-backend-down:

.PHONY: docker-backend-rebuild
docker-backend-rebuild:
make docker-backend-down; make docker-backend-up
make docker-backend-down; make docker-backend-up

.PHONY: app-build-development
app-build-development:
cd mobile-app && npx eas-cli build -p ios --profile development --local --output=../.gen-builds/build.tar.gz

.PHONY: app-build-preview
app-build-preview:
cd mobile-app && npx eas-cli build -p ios --profile preview --local --output=../.gen-builds/build.tar.gz

.PHONY: app-build-staging
app-build-staging:
cd mobile-app && npx eas-cli build -p ios --profile staging --local --output=../.gen-builds/build.ipa --non-interactive

7 changes: 4 additions & 3 deletions mobile-app/api/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import packageJson from '../package.json';
/** the spaced format of group invite codes. `[3, 4, 3]` => `"xxx xxxx xxx"` */
const groupCodeFormat = [3, 3, 3];

const host = process.env.EXPO_PUBLIC_API_BASE_URL;
const httpUrl = process.env.EXPO_PUBLIC_API_BASE_URL;
const wsUrl = process.env.EXPO_PUBLIC_API_WS_URL;

const groupCodeSeperatorIndices = groupCodeFormat.slice(1).map((_, idx) => {
return groupCodeFormat.slice(0, idx + 1).reduce((sum, i) => sum + i, 0) - 1;
Expand All @@ -30,8 +31,8 @@ const getDayName = (date: Dayjs) => {
};

export const env = {
apiBaseUrl: 'http://' + host,
realtimeBaseUrl: 'ws://' + host,
apiBaseUrl: httpUrl,
realtimeBaseUrl: wsUrl,

groupCode: {
format: groupCodeFormat,
Expand Down
15 changes: 12 additions & 3 deletions mobile-app/app.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"expo": {
"name": "beerpong-tournament",
"slug": "beerpong-tournament",
"version": "1.0.0",
"slug": "mobile-app",
"version": "1.0.1",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "myapp",
Expand All @@ -23,7 +23,9 @@
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#ffffff"
}
},
"permissions": ["android.permission.RECORD_AUDIO"],
"package": "com.linusbolls.mobileapp"
},
"web": {
"bundler": "metro",
Expand All @@ -39,6 +41,13 @@
"project": "beerpong",
"organization": "sackverein"
}
],
[
"expo-image-picker",
{
"photosPermission": "The app accesses your photos to let you choose a picture",
"cameraPermission": "The app accesses your photos to let take a pic"
}
]
],
"experiments": {
Expand Down
21 changes: 15 additions & 6 deletions mobile-app/eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,36 @@
},
"build": {
"development": {
"env": {
"EXPO_PUBLIC_API_BASE_URL": "http://localhost:8080",
"SENTRY_DISABLE_AUTO_UPLOAD": "true",
"EXPO_PUBLIC_API_WS_URL": "ws://localhost:8080"
},
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"env": {
"EXPO_PUBLIC_API_BASE_URL": "localhost:8080",
"SENTRY_DISABLE_AUTO_UPLOAD": true
"EXPO_PUBLIC_API_BASE_URL": "http://localhost:8080",
"SENTRY_DISABLE_AUTO_UPLOAD": "true",
"EXPO_PUBLIC_API_WS_URL": "ws://localhost:8080"
},
"ios": {
"simulator": true
}
},
"staging": {
"env": {
"EXPO_PUBLIC_API_BASE_URL": "beerpong.lb.laurinnotemann.dev"
},
"distribution": "internal"
"EXPO_PUBLIC_API_BASE_URL": "https://beerpong.lb.staging.laurinnotemann.dev",
"EXPO_PUBLIC_API_WS_URL": "wss://beerpong.lb.staging.laurinnotemann.dev",
"SENTRY_ALLOW_FAILURE": "true"
}
},
"production": {
"env": {
"EXPO_PUBLIC_API_BASE_URL": "beerpong.lb.laurinnotemann.dev"
"EXPO_PUBLIC_API_BASE_URL": "https://beerpong.lb.laurinnotemann.dev",
"EXPO_PUBLIC_API_WS_URL": "wss://beerpong.lb.laurinnotemann.dev",
"SENTRY_ALLOW_FAILURE": "true"
},
"autoIncrement": true
}
Expand Down
117 changes: 109 additions & 8 deletions mobile-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading