diff --git a/.github/workflows/eas-build-android.yml b/.github/workflows/eas-build-android.yml index b44a89c..3231436 100644 --- a/.github/workflows/eas-build-android.yml +++ b/.github/workflows/eas-build-android.yml @@ -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 }} diff --git a/.github/workflows/eas-build-debug.yml b/.github/workflows/eas-build-debug.yml new file mode 100644 index 0000000..7fd559f --- /dev/null +++ b/.github/workflows/eas-build-debug.yml @@ -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 }} diff --git a/.github/workflows/eas-build-ios.yml b/.github/workflows/eas-build-ios.yml index c243575..f5955c7 100644 --- a/.github/workflows/eas-build-ios.yml +++ b/.github/workflows/eas-build-ios.yml @@ -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 }} diff --git a/.github/workflows/eas-ota-update-auto.yml b/.github/workflows/eas-ota-update-auto.yml index 1d88d16..384b099 100644 --- a/.github/workflows/eas-ota-update-auto.yml +++ b/.github/workflows/eas-ota-update-auto.yml @@ -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 }} diff --git a/.github/workflows/eas-ota-update-manual.yml b/.github/workflows/eas-ota-update-manual.yml index 3202abb..ea5ef46 100644 --- a/.github/workflows/eas-ota-update-manual.yml +++ b/.github/workflows/eas-ota-update-manual.yml @@ -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 @@ -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 }} diff --git a/docs/expo/development.md b/docs/expo/development.md new file mode 100644 index 0000000..e9edce2 --- /dev/null +++ b/docs/expo/development.md @@ -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 diff --git a/expo/app.config.js b/expo/app.config.js index d36930f..d6cc25a 100644 --- a/expo/app.config.js +++ b/expo/app.config.js @@ -1,4 +1,3 @@ -const fs = require('fs'); const path = require('path'); const config = require('./app.config.default').expo; @@ -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); }; diff --git a/expo/config/.gitignore b/expo/config/.gitignore index 6d309f0..f89e16c 100644 --- a/expo/config/.gitignore +++ b/expo/config/.gitignore @@ -6,4 +6,5 @@ !google-services.json.env !GoogleService-Info.plist.env !AppStoreKey.p8.env +!PlayStoreKey.json.env !.gitignore diff --git a/expo/config/PlayStoreKey.json.env b/expo/config/PlayStoreKey.json.env new file mode 100644 index 0000000..feaace5 --- /dev/null +++ b/expo/config/PlayStoreKey.json.env @@ -0,0 +1 @@ +$PLAY_STORE_KEY \ No newline at end of file diff --git a/expo/config/dev/hpapp-dev.plist b/expo/config/dev/hpapp-dev.plist new file mode 100644 index 0000000..d323c39 --- /dev/null +++ b/expo/config/dev/hpapp-dev.plist @@ -0,0 +1,52 @@ + + + + + + items + + + assets + + + kind + software-package + url + https://storage.googleapis.com/hpapp.yssk22.dev/artifacts/hpapp-dev.ipa + + + kind + display-image + url + https://storage.googleapis.com/hpapp.yssk22.dev/artifacts/hpapp-dev.png + + + kind + full-size-image + url + https://storage.googleapis.com/hpapp.yssk22.dev/artifacts/hpapp-dev.png + + + metadata + + bundle-identifier + dev.yssk22.hpapp.dev + bundle-version + 1.0 + kind + software + title + HELLO!FAN (DEV) + + + + + \ No newline at end of file