Skip to content

Commit

Permalink
Merge pull request #3356 from tloncorp/promote-5-9
Browse files Browse the repository at this point in the history
Promote 5 9
  • Loading branch information
arthyn authored Mar 20, 2024
2 parents c0a9e37 + a055592 commit 5f776bc
Show file tree
Hide file tree
Showing 122 changed files with 4,535 additions and 2,189 deletions.
43 changes: 43 additions & 0 deletions .github/helpers/create_moon.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash

# this script creates a moon for an ephemeral deployment on a ship.
# assumes gcloud credentials are loaded and gcloud installed.

ship=$1
zone=$2
project=$3

echo "Creating a moon under $ship in $zone of $project"
set -e
set -o pipefail
cmdfile=$(mktemp "${TMPDIR:-/tmp/}moonspawn.XXXXXXXXX")
moondir=$(mktemp "${TMPDIR:-/urbit/}moondir.XXXXXXXXX")
# mktemp only used for generating a random folder name below
cmds='
click -kp /urbit/natmud-mogzod \
(our hoon thread to make a moon here) > $moondir/details ## need to provide actual hoon thread to extract moon name and keys + write to file
moon_name =$(cat $moondir/details | grep "some pattern for getting moon name")
moon_key =$(cat $moondir/details | grep "some pattern for getting moon key")
mkdir $moondir/$moon_name
urbit -w $moondir/$moon_name -k $moon_key ## we need to run this in a detached way
curl ... #some check to see if the moon is up
'
echo "$cmds"
echo "$cmds" >> "$cmdfile"
sshpriv=$(mktemp "${TMPDIR:-/tmp/}ssh.XXXXXXXXX")
sshpub=$sshpriv.pub
echo "$SSH_PUB_KEY" >> "$sshpub"
echo "$SSH_SEC_KEY" >> "$sshpriv"
chmod 600 $sshpub
chmod 600 $sshpriv

gcloud compute \
--project "$project" \
ssh \
--tunnel-through-iap \
--ssh-key-file "$sshpriv" \
--ssh-flag="-T" \
--zone "$zone" --verbosity info \
urb@"$ship" < "$cmdfile"

echo "moon created"
107 changes: 107 additions & 0 deletions .github/workflows/deploy-ephemeral.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Deploy Groups (ephemeral)
on:
push:
branches:
- 'do/ephemeral-moons'

#pull_request:

jobs:
build-frontend:
runs-on: ubuntu-latest
name: 'Build Frontend'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc

- name: Install Dependencies
run: npm ci

- working-directory: ./apps/tlon-web
run:
npm run build

- uses: actions/upload-artifact@v4
with:
name: 'ui-dist'
path: apps/tlon-web/dist

glob:
runs-on: ubuntu-latest
name: 'Make a glob'
needs: build-frontend
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: 'ui-dist'
path: apps/tlon-web/dist
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_SERVICE_KEY }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
- name: 'glob'
uses: ./.github/actions/glob
with:
folder: 'apps/tlon-web/dist/*'
docket: 'desk/desk.docket-0'
- name: Commit and Push Glob
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
git add desk/desk.docket-0
git commit -n -m "update glob: ${{ steps.glob.outputs.hash }} [skip actions]" || echo "No changes to commit"
INPUT=${{ env.tag }}
BRANCH=${INPUT:-"staging"}
git pull origin $BRANCH --rebase --autostash
git push
create_moon:
runs-on: ubuntu-latest
name: "Create Moon"
needs: glob
steps:
- uses: actions/checkout@v4
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_SERVICE_KEY }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
- id: create_moon
name: Create Moon
run: |
./.github/helpers/create_moon.sh ephemeral-landscape-apps-moon-host us-central1-a mainnet-tlon-other-2d
env:
SSH_SEC_KEY: ${{ secrets.GCP_SSH_SEC_KEY }}
SSH_PUB_KEY: ${{ secrets.GCP_SSH_PUB_KEY }}


deploy:
needs: create_moon
runs-on: ubuntu-latest
name: "Release to ~binnec-dozzod-marnus (canary)"
steps:
- uses: actions/checkout@v4
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_SERVICE_KEY }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
- id: deploy
name: Deploy
run:
./.github/helpers/deploy.sh tloncorp/landscape-apps groups ${{ needs.build_test_images.outputs.moon_name }} us-central1-a mainnet-tlon-other-2d
env:
SSH_SEC_KEY: ${{ secrets.GCP_SSH_SEC_KEY }}
SSH_PUB_KEY: ${{ secrets.GCP_SSH_PUB_KEY }}
URBIT_REPO_TAG: ${{ vars.URBIT_REPO_TAG }}
11 changes: 7 additions & 4 deletions .github/workflows/mobile-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ on:
- all
- android
- ios
env:
NOTIFY_PROVIDER: rivfur-livmet
NOTIFY_SERVICE: groups-native
jobs:
deploy:
runs-on: ubuntu-latest
Expand All @@ -36,9 +33,15 @@ jobs:
token: ${{ secrets.EXPO_TOKEN }}
- name: Install dependencies
run: npm ci
- name: Create build vars
id: vars
run: |
echo "profile=${{ inputs.profile || 'preview' }}" >> $GITHUB_OUTPUT
- name: Build for selected platforms
working-directory: ./apps/tlon-mobile
run: eas build --profile ${{ inputs.profile || 'preview' }} --platform ${{ inputs.platform || 'all' }} --non-interactive --auto-submit
run: eas build --profile ${{ steps.vars.outputs.profile }} --platform ${{ inputs.platform || 'all' }} --non-interactive --auto-submit
env:
EXPO_APPLE_ID: ${{ secrets.EXPO_APPLE_ID }}
EXPO_APPLE_PASSWORD: ${{ secrets.EXPO_APPLE_PASSWORD }}
NOTIFY_PROVIDER: "${{ steps.vars.outputs.profile == 'preview' && 'binnec-dozzod-marnus' || 'rivfur-livmet' }}"
NOTIFY_SERVICE: "${{ steps.vars.outputs.profile == 'preview' && 'tlon-preview-release' || 'groups-native' }}"
12 changes: 8 additions & 4 deletions .github/workflows/mobile-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ on:
- all
- android
- ios
env:
NOTIFY_PROVIDER: rivfur-livmet
NOTIFY_SERVICE: groups-native
jobs:
deploy:
runs-on: ubuntu-latest
Expand All @@ -36,6 +33,13 @@ jobs:
token: ${{ secrets.EXPO_TOKEN }}
- name: Install dependencies
run: npm ci
- name: Create build vars
id: vars
run: |
echo "profile=${{ inputs.profile || 'preview' }}" >> $GITHUB_OUTPUT
- name: Push update for selected platforms
working-directory: ./apps/tlon-mobile
run: eas update --auto --profile ${{ inputs.profile || 'preview' }} --platform ${{ inputs.platform || 'all' }} --non-interactive
run: eas update --auto --profile ${{ steps.vars.outputs.profile }} --platform ${{ inputs.platform || 'all' }} --non-interactive
env:
NOTIFY_PROVIDER: "${{ steps.vars.outputs.profile == 'preview' && 'binnec-dozzod-marnus' || 'rivfur-livmet' }}"
NOTIFY_SERVICE: "${{ steps.vars.outputs.profile == 'preview' && 'tlon-preview-release' || 'groups-native' }}"
4 changes: 4 additions & 0 deletions apps/tlon-mobile/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ DEFAULT_LURE=
DEFAULT_PRIORITY_TOKEN=
RECAPTCHA_SITE_KEY_ANDROID=
RECAPTCHA_SITE_KEY_IOS=
DEFAULT_TLON_LOGIN_EMAIL=
DEFAULT_TLON_LOGIN_PASSWORD=
DEFAULT_SHIP_LOGIN_URL=
DEFAULT_SHIP_LOGIN_ACCESS_CODE=
31 changes: 31 additions & 0 deletions apps/tlon-mobile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,37 @@ Plug in your iOS device or start the iPhone Simulator and run the application in
npm run ios
```

#### Run Preview Scheme

Run the Preview version of the app by specifying `scheme` or `variant` in the run command:

```sh
npm run ios -- --scheme=Landscape-preview
```

```sh
npm run android -- --variant=preview
```

## Debugging

### Dev tools

Press `j` while running expo-cli/metro to open chrome devtools. You can use the devtools to view logs, network requests, and more. [More info here](https://docs.expo.dev/debugging/tools/#debugging-with-chrome-devtools).

### Default Credentials

To streamline testing the login flow, you can use env variables to prepopulate fields in the Tlon Login and ship login screen. The relevant variables are:

```
DEFAULT_TLON_LOGIN_EMAIL=
DEFAULT_TLON_LOGIN_PASSWORD=
DEFAULT_SHIP_LOGIN_URL=
DEFAULT_SHIP_LOGIN_ACCESS_CODE=
```

See `.env.sample` for other configurable env variables.

## Deployment

Deployment is handled by [Expo Application Services](https://expo.dev/eas).
Expand Down
2 changes: 1 addition & 1 deletion apps/tlon-mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
compileSdk rootProject.ext.compileSdkVersion
versionCode 48
versionCode 62
versionName "4.0.0"

buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString())
Expand Down
28 changes: 4 additions & 24 deletions apps/tlon-mobile/android/app/google-services.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,15 @@
"package_name": "io.tlon.groups"
}
},
"oauth_client": [
{
"client_id": "543296749236-1l5r4ipguvjdh083t5j7h1eicqi21j0o.apps.googleusercontent.com",
"client_type": 3
}
],
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyDm8-5daeW5B8j6i_RIoSvOgnx6Fo0gEOU"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "543296749236-1l5r4ipguvjdh083t5j7h1eicqi21j0o.apps.googleusercontent.com",
"client_type": 3
}
]
"other_platform_oauth_client": []
}
}
},
Expand All @@ -41,25 +31,15 @@
"package_name": "io.tlon.groups.preview"
}
},
"oauth_client": [
{
"client_id": "543296749236-1l5r4ipguvjdh083t5j7h1eicqi21j0o.apps.googleusercontent.com",
"client_type": 3
}
],
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyDm8-5daeW5B8j6i_RIoSvOgnx6Fo0gEOU"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "543296749236-1l5r4ipguvjdh083t5j7h1eicqi21j0o.apps.googleusercontent.com",
"client_type": 3
}
]
"other_platform_oauth_client": []
}
}
}
Expand Down
10 changes: 6 additions & 4 deletions apps/tlon-mobile/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,23 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
shipUrlPattern: process.env.SHIP_URL_PATTERN,
defaultLure: process.env.DEFAULT_LURE,
defaultPriorityToken: process.env.DEFAULT_PRIORITY_TOKEN,
defaultTlonLoginEmail: process.env.DEFAULT_TLON_LOGIN_EMAIL,
defaultTlonLoginPassword: process.env.DEFAULT_TLON_LOGIN_PASSWORD,
defaultShipLoginUrl: process.env.DEFAULT_SHIP_LOGIN_URL,
defaultShipLoginAccessCode: process.env.DEFAULT_SHIP_LOGIN_ACCESS_CODE,
recaptchaSiteKeyAndroid: process.env.RECAPTCHA_SITE_KEY_ANDROID,
recaptchaSiteKeyIOS: process.env.RECAPTCHA_SITE_KEY_IOS,
devLocal: Boolean(process.env.DEV_LOCAL),
devLocalCode: process.env.DEV_LOCAL_CODE,
},
ios: {
runtimeVersion: '4.0.0',
buildNumber: '48',
buildNumber: '62',
config: {
usesNonExemptEncryption: false,
},
},
android: {
runtimeVersion: '4.0.0',
versionCode: 48,
versionCode: 62,
},
updates: {
url: `https://u.expo.dev/${projectId}`,
Expand Down
6 changes: 6 additions & 0 deletions apps/tlon-mobile/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { registerRootComponent } from 'expo';
import 'expo-dev-client';
import polyfill from 'react-native-polyfill-globals';
import { TailwindProvider } from 'tailwind-rn';

import App from './src/App';
import utilities from './tailwind.json';

// Modifies fetch to support server sent events which
// are required for Urbit client subscriptions
polyfill();

function Main(props) {
return (
<TailwindProvider utilities={utilities}>
Expand Down
Loading

0 comments on commit 5f776bc

Please sign in to comment.