From 9e71c3d0544e43aa68a48792cdea5845cd3419e2 Mon Sep 17 00:00:00 2001 From: chinweikemichael Date: Tue, 13 May 2025 23:50:40 +0100 Subject: [PATCH 1/7] build: implement actions for mobile CI/CD --- .github/workflows/build-and-submit-prod.yml | 27 +++++++++++++ .github/workflows/ota-publish.yml | 23 +++++++++++ .github/workflows/preview-android-feature.yml | 38 +++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 .github/workflows/build-and-submit-prod.yml create mode 100644 .github/workflows/ota-publish.yml create mode 100644 .github/workflows/preview-android-feature.yml diff --git a/.github/workflows/build-and-submit-prod.yml b/.github/workflows/build-and-submit-prod.yml new file mode 100644 index 0000000..0f132e0 --- /dev/null +++ b/.github/workflows/build-and-submit-prod.yml @@ -0,0 +1,27 @@ +name: Build & Submit Production + +on: + pull_request: + branches: [main] + paths-ignore: ["docs/**"] + types: [opened, synchronize] + # Only run if PR is from `dev` branch + if: github.head_ref == 'dev' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + + - run: npm install -g eas-cli + - run: eas login --token ${{ secrets.EAS_TOKEN }} + + - run: eas build --platform android --profile production --non-interactive --no-wait + - run: eas build --platform ios --profile production --non-interactive --no-wait + + - run: eas submit --platform android --profile production --non-interactive + - run: eas submit --platform ios --profile production --non-interactive diff --git a/.github/workflows/ota-publish.yml b/.github/workflows/ota-publish.yml new file mode 100644 index 0000000..ea3bc78 --- /dev/null +++ b/.github/workflows/ota-publish.yml @@ -0,0 +1,23 @@ +name: OTA Publish to Production + +on: + pull_request: + branches: [main] + types: [opened, synchronize] + # Only if PR is from `ota/*` + if: startsWith(github.head_ref, 'ota/') + +jobs: + publish-ota: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + + - run: npm install -g eas-cli + - run: eas login --token ${{ secrets.EAS_TOKEN }} + + - run: eas update --channel production --platform android --non-interactive diff --git a/.github/workflows/preview-android-feature.yml b/.github/workflows/preview-android-feature.yml new file mode 100644 index 0000000..26cb4af --- /dev/null +++ b/.github/workflows/preview-android-feature.yml @@ -0,0 +1,38 @@ +name: Preview Android Build (Feature Branch) + +on: + pull_request: + types: [opened, synchronize] + branches-ignore: [] + paths-ignore: ["docs/**"] + +jobs: + preview-android: + if: startsWith(github.head_ref, 'feature/') + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + + - run: npm install -g eas-cli + - run: eas login --token ${{ secrets.EAS_TOKEN }} + + - name: Trigger EAS Android build (preview) + id: eas_build + run: | + eas build --platform android --profile preview --non-interactive --json > build.json + BUILD_URL=$(cat build.json | jq -r '.[0].artifacts.buildUrl') + echo "BUILD_URL=$BUILD_URL" >> $GITHUB_ENV + + - name: Post PR comment with preview link + if: github.event_name == 'pull_request' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr comment "$PR_URL" --body "🚀 Preview APK is ready! [Download here]($BUILD_URL)" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + BUILD_URL: ${{ env.BUILD_URL }} \ No newline at end of file From 2dfef3a40e80410e1c5f9f50230cf113c0ad0b2e Mon Sep 17 00:00:00 2001 From: chinweikemichael Date: Tue, 13 May 2025 23:50:57 +0100 Subject: [PATCH 2/7] build: setup profile for EAS --- eas.json | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/eas.json b/eas.json index a27779f..68fc01c 100644 --- a/eas.json +++ b/eas.json @@ -10,6 +10,41 @@ "resourceClass": "m-medium" }, "channel": "development" + }, + "preview": { + "distribution": "internal", + "channel": "staging", + "ios": { + "resourceClass": "m-medium" + } + }, + "production": { + "channel": "production", + "ios": { + "resourceClass": "m-medium" + } + } + }, + "submit": { + "preview": { + "ios": { + "appleId": "infinitymichael7@gmail.com", + "ascAppId": "", + "appleTeamId": "" + }, + "android": { + "track": "internal" + } + }, + "production": { + "ios": { + "appleId": "infinitymichael7@gmail.com", + "ascAppId": "", + "appleTeamId": "" + }, + "android": { + "track": "production" + } } } } \ No newline at end of file From f1b2c982679e26e001d7011b0b4b2fe595177a3f Mon Sep 17 00:00:00 2001 From: chinweikemichael Date: Tue, 13 May 2025 23:53:01 +0100 Subject: [PATCH 3/7] chore: commented out OTA updated --- .github/workflows/ota-publish.yml | 36 +++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ota-publish.yml b/.github/workflows/ota-publish.yml index ea3bc78..7f91603 100644 --- a/.github/workflows/ota-publish.yml +++ b/.github/workflows/ota-publish.yml @@ -1,23 +1,23 @@ -name: OTA Publish to Production +# name: OTA Publish to Production -on: - pull_request: - branches: [main] - types: [opened, synchronize] - # Only if PR is from `ota/*` - if: startsWith(github.head_ref, 'ota/') +# on: +# pull_request: +# branches: [main] +# types: [opened, synchronize] +# # Only if PR is from `ota/*` +# if: startsWith(github.head_ref, 'ota/') -jobs: - publish-ota: - runs-on: ubuntu-latest +# jobs: +# publish-ota: +# runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 +# steps: +# - uses: actions/checkout@v3 +# - uses: actions/setup-node@v3 +# with: +# node-version: 18 - - run: npm install -g eas-cli - - run: eas login --token ${{ secrets.EAS_TOKEN }} +# - run: npm install -g eas-cli +# - run: eas login --token ${{ secrets.EAS_TOKEN }} - - run: eas update --channel production --platform android --non-interactive +# - run: eas update --channel production --platform android --non-interactive From 27f8ae6076df6d35cb66881258040fc092d1ae29 Mon Sep 17 00:00:00 2001 From: chinweikemichael Date: Tue, 13 May 2025 23:57:56 +0100 Subject: [PATCH 4/7] build: updated prod yml and fixed eas auth issue on preview build --- .github/workflows/build-and-submit-prod.yml | 44 +++++++++---------- .github/workflows/preview-android-feature.yml | 18 +++++--- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build-and-submit-prod.yml b/.github/workflows/build-and-submit-prod.yml index 0f132e0..616680d 100644 --- a/.github/workflows/build-and-submit-prod.yml +++ b/.github/workflows/build-and-submit-prod.yml @@ -1,27 +1,27 @@ -name: Build & Submit Production +# name: Build & Submit Production -on: - pull_request: - branches: [main] - paths-ignore: ["docs/**"] - types: [opened, synchronize] - # Only run if PR is from `dev` branch - if: github.head_ref == 'dev' +# on: +# pull_request: +# branches: [main] +# paths-ignore: ["docs/**"] +# types: [opened, synchronize] +# # Only run if PR is from `dev` branch +# if: github.head_ref == 'dev' -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 +# jobs: +# build: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - uses: actions/setup-node@v3 +# with: +# node-version: 18 - - run: npm install -g eas-cli - - run: eas login --token ${{ secrets.EAS_TOKEN }} +# - run: npm install -g eas-cli +# - run: eas login --token ${{ secrets.EAS_TOKEN }} - - run: eas build --platform android --profile production --non-interactive --no-wait - - run: eas build --platform ios --profile production --non-interactive --no-wait +# - run: eas build --platform android --profile production --non-interactive --no-wait +# - run: eas build --platform ios --profile production --non-interactive --no-wait - - run: eas submit --platform android --profile production --non-interactive - - run: eas submit --platform ios --profile production --non-interactive +# - run: eas submit --platform android --profile production --non-interactive +# - run: eas submit --platform ios --profile production --non-interactive diff --git a/.github/workflows/preview-android-feature.yml b/.github/workflows/preview-android-feature.yml index 26cb4af..e0c67ad 100644 --- a/.github/workflows/preview-android-feature.yml +++ b/.github/workflows/preview-android-feature.yml @@ -3,12 +3,12 @@ name: Preview Android Build (Feature Branch) on: pull_request: types: [opened, synchronize] - branches-ignore: [] - paths-ignore: ["docs/**"] + branches: [main] + # paths-ignore: ["docs/**"] jobs: preview-android: - if: startsWith(github.head_ref, 'feature/') + # if: startsWith(github.head_ref, 'feature/') runs-on: ubuntu-latest steps: @@ -16,9 +16,17 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 + cache: yarn + + - name: 🏗 Setup EAS + uses: expo/expo-github-action@v8 + with: + eas-version: latest + token: ${{ secrets.EAS_TOKEN }} + + - name: 📦 Install dependencies + run: yarn install - - run: npm install -g eas-cli - - run: eas login --token ${{ secrets.EAS_TOKEN }} - name: Trigger EAS Android build (preview) id: eas_build From c082e20f235174a31c3c4571489c57ec019cfab7 Mon Sep 17 00:00:00 2001 From: chinweikemichael Date: Wed, 14 May 2025 00:00:15 +0100 Subject: [PATCH 5/7] build: fixed preview CI build job --- .github/workflows/preview-android-feature.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/preview-android-feature.yml b/.github/workflows/preview-android-feature.yml index e0c67ad..cc6d6c8 100644 --- a/.github/workflows/preview-android-feature.yml +++ b/.github/workflows/preview-android-feature.yml @@ -2,13 +2,13 @@ name: Preview Android Build (Feature Branch) on: pull_request: - types: [opened, synchronize] branches: [main] - # paths-ignore: ["docs/**"] - + paths-ignore: ["docs/**"] + types: [opened, synchronize] + # Only run if PR is from `dev` branch + if: github.head_ref == 'dev' jobs: preview-android: - # if: startsWith(github.head_ref, 'feature/') runs-on: ubuntu-latest steps: @@ -16,13 +16,14 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 - cache: yarn + cache: yarn + - name: 🏗 Setup EAS uses: expo/expo-github-action@v8 with: eas-version: latest - token: ${{ secrets.EAS_TOKEN }} + token: ${{ secrets.EXPO_TOKEN }} - name: 📦 Install dependencies run: yarn install From e872e7a5946f538e8dce6b718d2172100997fcc1 Mon Sep 17 00:00:00 2001 From: chinweikemichael Date: Wed, 14 May 2025 00:01:44 +0100 Subject: [PATCH 6/7] build: modified scripts --- .github/workflows/preview-android-feature.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/preview-android-feature.yml b/.github/workflows/preview-android-feature.yml index cc6d6c8..dcee8d8 100644 --- a/.github/workflows/preview-android-feature.yml +++ b/.github/workflows/preview-android-feature.yml @@ -3,14 +3,10 @@ name: Preview Android Build (Feature Branch) on: pull_request: branches: [main] - paths-ignore: ["docs/**"] - types: [opened, synchronize] - # Only run if PR is from `dev` branch - if: github.head_ref == 'dev' + jobs: - preview-android: + build: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 From bc0a1484ec88c89b1bb69e89f5d25dd3e1396528 Mon Sep 17 00:00:00 2001 From: chinweikemichael Date: Wed, 14 May 2025 00:02:41 +0100 Subject: [PATCH 7/7] build: added test for new push --- .github/workflows/preview-android-feature.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/preview-android-feature.yml b/.github/workflows/preview-android-feature.yml index dcee8d8..216b19f 100644 --- a/.github/workflows/preview-android-feature.yml +++ b/.github/workflows/preview-android-feature.yml @@ -1,6 +1,9 @@ name: Preview Android Build (Feature Branch) on: + push: + branches: + - "**" pull_request: branches: [main]