Skip to content

Commit

Permalink
[workflow] refactor and fixes.
Browse files Browse the repository at this point in the history
**Summary**

- split the build steps and submit steps.
- remove expo/.gitignore for build proces to refer to .env.local correctly.
- fix update actions

**Test**

- N/A

**Issue**

- N/A
  • Loading branch information
yssk22 committed Dec 24, 2024
1 parent 19c9284 commit 50e54b9
Show file tree
Hide file tree
Showing 10 changed files with 221 additions and 36 deletions.
53 changes: 47 additions & 6 deletions .github/workflows/eas-build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,30 +64,71 @@ jobs:
distribution: "temurin"
- uses: android-actions/setup-android@v3
- run: cd expo && rm ./config/${{ matrix.target }}/.gitignore
- run: cd expo && rm ./.gitignore
- run: cd expo && yarn install
- run: cd expo && envsubst < ./.env > ./.env.local
env:
APP_CHECK_DEBUG_TOKEN: ${{ secrets.APP_CHECK_DEBUG_TOKEN }}
GRAPHQL_ENDPOINT: ${{ secrets.GRAPHQL_ENDPOINT }}
- run: cd expo && ./scripts/eas.sh build --profile ${{ matrix.target }} --platform android --local --output ./build/hpapp-${{ matrix.target }}.apk
- run: cd expo && ./scripts/eas.sh build --profile ${{ matrix.target }} --platform android --local --output ${{ github.workspace }}/expo/build/hpapp-${{ matrix.target }}.apk
if: ${{ matrix.target == 'dev' }}
env:
HPAPP_CONFIG_NAME: ${{ matrix.target }}
SECRETS_JSON: ${{ secrets.SECRETS_JSON }}
GOOGLE_SERVICES_INFO_PLIST: ${{ secrets.GOOGLE_SERVICES_INFO_PLIST }}
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
- run: cd expo && ./scripts/eas.sh build --profile ${{ matrix.target }} --platform android --local --output ./build/hpapp-${{ matrix.target }}.aab
- run: cd expo && ./scripts/eas.sh build --profile ${{ matrix.target }} --platform android --local --output ${{ github.workspace }}/expo/build/hpapp-${{ matrix.target }}.aab
if: ${{ matrix.target != 'dev' }}
env:
HPAPP_CONFIG_NAME: ${{ matrix.target }}
GOOGLE_SERVICES_INFO_PLIST: ${{ secrets.GOOGLE_SERVICES_INFO_PLIST }}
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
# [dev] upload artifacts
- uses: actions/upload-artifact@v4
if: ${{ matrix.target == 'dev' }}
with:
name: hpapp-${{ matrix.target }}.apk
path: ${{ github.workspace }}/expo/build/hpapp-${{ matrix.target }}.apk
# [beta/prod] submit
- run: cd expo && envsubst < ./config/eas.json.env > ./config/eas.json
- uses: actions/upload-artifact@v4
if: ${{ matrix.target != 'dev' }}
with:
name: hpapp-${{ matrix.target }}.aab
path: ${{ github.workspace }}/expo/build/hpapp-${{ matrix.target }}.aab
submit:
needs: [generate-matrix, build]
strategy:
matrix:
target: ${{ fromJson(needs.generate-matrix.outputs.target) }}
exclude:
- target: dev
runs-on: ubuntu-latest
environment:
name: eas-${{ matrix.target }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"
cache-dependency-path: "expo/package.json"
- uses: expo/expo-github-action@v8
with:
eas-version: ${{ env.EAS_VERSION }}
token: ${{ secrets.EXPO_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: hpapp-${{ matrix.target }}.aab
path: ${{ github.workspace }}/expo/build/
- run: cd expo && yarn install
- run: cd expo && rm ./config/${{ matrix.target }}/.gitignore
- run: cd expo && rm ./.gitignore
- run: cd expo && envsubst < ./config/eas.json.env > ./config/eas.json
env:
EAS_SUBMIT: ${{ secrets.EAS_SUBMIT }}
- run: cd expo && envsubst < ./config/PlayStoreKey.json.env > ./config/PlayStoreKey.json
env:
EAS_SUBMIT: ${{ secrets.EAS_SUBMIT }}
PLAY_STORE_KEY: ${{ secrets.PLAY_STORE_KEY }}
- run: cd expo && ./scripts/eas.sh submit --profile ${{ matrix.target }} --platform android --non-interactive --path ${{ github.workspace }}/expo/build/hpapp-${{ matrix.target }}.aab
if: ${{ matrix.target != 'dev' }}
env:
HPAPP_CONFIG_NAME: ${{ matrix.target }}
EXPO_APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.EXPO_APPLE_APP_SPECIFIC_PASSWORD }}
35 changes: 35 additions & 0 deletions .github/workflows/eas-build-debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: EAS - Build Debug
on:
workflow_dispatch:
inputs:
dev:
description: "HPAPP_CONFIG_NAME=dev"
required: false
type: boolean
default: false
beta:
description: "HPAPP_CONFIG_NAME=beta"
required: false
type: boolean
default: false
prod:
description: "HPAPP_CONFIG_NAME=prod"
required: false
type: boolean
default: false
env:
NODE_VERSION: 22.3.0
EAS_VERSION: 13.4.2
JAVA_VERSION: 17
jobs:
test:
if: ${{ github.event.inputs.dev = true }}
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"
environment:
name: gcp-go
steps:
- uses: actions/checkout@v3
- run: echo ${{ github.event.inputs.dev }}
39 changes: 32 additions & 7 deletions .github/workflows/eas-build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,33 +59,58 @@ jobs:
eas-version: ${{ env.EAS_VERSION }}
token: ${{ secrets.EXPO_TOKEN }}
- run: cd expo && rm ./config/${{ matrix.target }}/.gitignore
- run: cd expo && rm ./.gitignore
- run: cd expo && yarn install
- run: cd expo && envsubst < ./.env > ./.env.local
env:
APP_CHECK_DEBUG_TOKEN: ${{ secrets.APP_CHECK_DEBUG_TOKEN }}
GRAPHQL_ENDPOINT: ${{ secrets.GRAPHQL_ENDPOINT }}
- run: cd expo && ./scripts/eas.sh build --profile ${{ matrix.target }} --platform ios --non-interactive --local --output ./build/hpapp-${{ matrix.target }}.ipa
- run: cd expo && ./scripts/eas.sh build --profile ${{ matrix.target }} --platform ios --non-interactive --local --output ${{ github.workspace }}/expo/build/hpapp-${{ matrix.target }}.ipa
env:
HPAPP_CONFIG_NAME: ${{ matrix.target }}
GOOGLE_SERVICES_INFO_PLIST: ${{ secrets.GOOGLE_SERVICES_INFO_PLIST }}
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
# upload artifacts
- uses: actions/upload-artifact@v4
with:
name: hpapp-${{ matrix.target }}.ipa
path: ${{ github.workspace }}/expo/build/hpapp-${{ matrix.target }}.ipa
# [beta/prod] submit
submit:
needs: [generate-matrix, build]
strategy:
matrix:
target: ${{ fromJson(needs.generate-matrix.outputs.target) }}
exclude:
- target: dev
runs-on: ubuntu-latest
environment:
name: eas-${{ matrix.target }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"
cache-dependency-path: "expo/package.json"
- uses: expo/expo-github-action@v8
with:
eas-version: ${{ env.EAS_VERSION }}
token: ${{ secrets.EXPO_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: hpapp-${{ matrix.target }}.ipa
path: ${{ github.workspace }}/expo/build/
- run: cd expo && yarn install
- run: cd expo && rm ./config/${{ matrix.target }}/.gitignore
- run: cd expo && rm ./.gitignore
- run: cd expo && envsubst < ./config/eas.json.env > ./config/eas.json
if: ${{ matrix.target != 'dev' }}
env:
EAS_SUBMIT: ${{ secrets.EAS_SUBMIT }}
- run: cd expo && envsubst < ./config/AppStoreKey.p8.env > ./config/AppStoreKey.p8
if: ${{ matrix.target != 'dev' }}
env:
EAS_SUBMIT: ${{ secrets.EAS_SUBMIT }}
APP_STORE_KEY: ${{ secrets.APP_STORE_KEY }}
- run: cd expo && ./scripts/eas.sh submit --profile ${{ matrix.target }} --platform ios --non-interactive --path ./build/hpapp-${{ matrix.target }}.ipa
- run: cd expo && ./scripts/eas.sh submit --profile ${{ matrix.target }} --platform ios --non-interactive --path ${{ github.workspace }}/expo/build/hpapp-${{ matrix.target }}.ipa
if: ${{ matrix.target != 'dev' }}
env:
HPAPP_CONFIG_NAME: ${{ matrix.target }}
EXPO_APPLE_APP_SPECIFIC_PASSWORD: ${{ secret.EXPO_APPLE_APP_SPECIFIC_PASSWORD }}
EXPO_APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.EXPO_APPLE_APP_SPECIFIC_PASSWORD }}
8 changes: 5 additions & 3 deletions .github/workflows/eas-ota-update-auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "22.3.0"
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"
cache-dependency-path: "expo/package.json"
- uses: expo/expo-github-action@v8
with:
eas-version: 13.4.2
eas-version: ${{ env.EAS_VERSION }}
token: ${{ secrets.EXPO_TOKEN }}
- run: cd expo && rm ./config/${{ matrix.target }}/.gitignore
- run: cd expo && rm ./.gitignore
- run: cd expo && yarn install
- run: cd expo && envsubst < ./.env > ./.env.local
- run: cd expo && ./scripts/eas.sh update --channel beta --non-interactive --auto
env:
HPAPP_CONFIG_NAME: beta
SECRETS_JSON: ${{ secrets.SECRETS_JSON }}
GOOGLE_SERVICES_INFO_PLIST: ${{ secrets.GOOGLE_SERVICES_INFO_PLIST }}
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
13 changes: 10 additions & 3 deletions .github/workflows/eas-ota-update-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
- beta
- prod

env:
NODE_VERSION: 22.3.0
EAS_VERSION: 13.4.2
JAVA_VERSION: 17
jobs:
update:
runs-on: ubuntu-latest
Expand All @@ -20,17 +24,20 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "22.3.0"
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"
cache-dependency-path: "expo/package.json"
- uses: expo/expo-github-action@v8
with:
eas-version: 13.4.2
eas-version: ${{ env.EAS_VERSION }}
token: ${{ secrets.EXPO_TOKEN }}
- run: cd expo && yarn install
- run: cd expo && rm ./config/${{ matrix.target }}/.gitignore
- run: cd expo && rm ./.gitignore
- run: cd expo && yarn install
- run: cd expo && envsubst < ./.env > ./.env.local
- run: cd expo && ./scripts/eas.sh update --channel ${{inputs.config}} --non-interactive --auto
env:
HPAPP_CONFIG_NAME: ${{inputs.config}}
SECRETS_JSON: ${{ secrets.SECRETS_JSON }}
GOOGLE_SERVICES_INFO_PLIST: ${{ secrets.GOOGLE_SERVICES_INFO_PLIST }}
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
36 changes: 36 additions & 0 deletions docs/expo/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# iOS/Android development

## Install development build

### for iOS

Scan the QR code below or open [iTunes Link](itms-services://?action=download-manifest;url=https://storage.googleapis.com/hpapp.yssk22.dev/hpapp-dev.plist) to install the development build.

![iOS QR code](https://storage.googleapis.com/hpapp.yssk22.dev/artifacts/QR-hpapp-dev.png)

### for Android

Scan the QR code below or open [iTunes Link](itms-services://?action=download-manifest;url=https://storage.googleapis.com/hpapp.yssk22.dev/hpapp-dev.plist) to install the development build.

![Android QR](https://storage.googleapis.com/hpapp.yssk22.dev/artifacts/QR-hpapp-android-dev.png)

## Start a development server

```bash
$ cloud_sql_proxy -instances=${GCP_PROJECT}:asia-northeast1:${GCP_DB}=tcp:3306
$ cd go
$ go run ./cmd/ --prod httpserver
```

## Start a metro bundler

```bash
$ cd expo
$ yarn install
$ export APP_CHECK_DEBUG_TOKEN=****
$ export GRAPHQL_ENDPOINT=http://{development_server}:8080
$ envsubst < ./.env > ./.env.local
$ yarn start
```

now you can launch the app on your device and connect to the metro bundler
19 changes: 2 additions & 17 deletions expo/app.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const fs = require('fs');
const path = require('path');

const config = require('./app.config.default').expo;
Expand All @@ -12,26 +11,12 @@ module.exports = (_) => {
// set resources located in config/{name}/ directory
config.icon = path.join('config', cfgName, 'icon.png');
config.splash.image = path.join('config', cfgName, 'splash.png');

const isEAS = process.env.EAS_BUILD === 'true';
const iosGoogleServicesFilePath = path.join('config', cfgName, 'GoogleService-Info.plist');
const androidGoogleServicesFilePath = path.join('config', cfgName, 'google-services.json');

if (fs.existsSync(iosGoogleServicesFilePath)) {
config.ios.googleServicesFile = iosGoogleServicesFilePath;
} else {
throw new Error('GoogleService-Info.plist file does not found in ' + iosGoogleServicesFilePath);
}
if (fs.existsSync(androidGoogleServicesFilePath)) {
config.android.googleServicesFile = androidGoogleServicesFilePath;
} else {
throw new Error('google-services.json file does not found in ' + androidGoogleServicesFilePath);
}
config.ios.googleServicesFile = path.join('config', cfgName, 'GoogleService-Info.plist');
config.android.googleServicesFile = path.join('config', cfgName, 'google-services.json');

// finally load the environment specific app.config.js
const configure = require('./' + path.join('config', cfgName, 'app.config.js'));

// reserverd extra configurations
config.extra.hpapp.isEAS = isEAS;
return configure(config);
};
1 change: 1 addition & 0 deletions expo/config/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
!google-services.json.env
!GoogleService-Info.plist.env
!AppStoreKey.p8.env
!PlayStoreKey.json.env
!.gitignore
1 change: 1 addition & 0 deletions expo/config/PlayStoreKey.json.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$PLAY_STORE_KEY
52 changes: 52 additions & 0 deletions expo/config/dev/hpapp-dev.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is a file for iOS devices to install ipa without App Storre.
- Upload this plist file to https://storage.googleapis.com/hpapp.yssk22.dev/artifacts/hpapp-dev.plist
- Upload the dev build (.ipa) to https://storage.googleapis.com/hpapp.yssk22.dev/artifacts/hpapp-dev.ipa
- Upload the icon.png to https://storage.googleapis.com/hpapp.yssk22.dev/artifacts/hpapp-dev.png
- Open `itms-services://?action=download-manifest;url=https://storage.googleapis.com/hpapp.yssk22.dev/artifacts/hpapp-dev.plist` in Safari to download and install.
-->
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>https://storage.googleapis.com/hpapp.yssk22.dev/artifacts/hpapp-dev.ipa</string>
</dict>
<dict>
<key>kind</key>
<string>display-image</string>
<key>url</key>
<string>https://storage.googleapis.com/hpapp.yssk22.dev/artifacts/hpapp-dev.png</string>
</dict>
<dict>
<key>kind</key>
<string>full-size-image</string>
<key>url</key>
<string>https://storage.googleapis.com/hpapp.yssk22.dev/artifacts/hpapp-dev.png</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>dev.yssk22.hpapp.dev</string>
<key>bundle-version</key>
<string>1.0</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>HELLO!FAN (DEV)</string>
</dict>
</dict>
</array>
</dict>
</plist>

0 comments on commit 50e54b9

Please sign in to comment.