From 95a0fe8b7e14f63e81680ecad1967204a360bc19 Mon Sep 17 00:00:00 2001 From: luke-h1 Date: Mon, 3 Mar 2025 18:03:27 +0000 Subject: [PATCH] test(ci): test alternate ci/cd workflow --- .github/workflows/eas-deploy-prod.yml | 177 ++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 .github/workflows/eas-deploy-prod.yml diff --git a/.github/workflows/eas-deploy-prod.yml b/.github/workflows/eas-deploy-prod.yml new file mode 100644 index 00000000..823dd93a --- /dev/null +++ b/.github/workflows/eas-deploy-prod.yml @@ -0,0 +1,177 @@ +name: React Native CI/CD + +on: + push: + branches: [main, master, develop] + paths-ignore: + - "**.md" + - "LICENSE" + - ".github/ISSUE_TEMPLATE/**" + - ".github/PULL_REQUEST_TEMPLATE.md" + - "docs/**" + pull_request: + branches: [main, master] + paths-ignore: + - "**.md" + - "LICENSE" + - ".github/ISSUE_TEMPLATE/**" + - ".github/PULL_REQUEST_TEMPLATE.md" + - "docs/**" + workflow_dispatch: + inputs: + buildType: + type: choice + description: "Build type to run" + options: + - all + - dev + - prod-apk + - prod-aab + +env: + EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }} + CLOUD_STORAGE_TYPE: ${{ secrets.CLOUD_STORAGE_TYPE }} + CLOUD_STORAGE_TOKEN: ${{ secrets.CLOUD_STORAGE_TOKEN }} + CLOUD_STORAGE_ROOT_ID: ${{ secrets.CLOUD_STORAGE_ROOT_ID }} + # Keeping legacy provider for older Node.js versions + NODE_OPTIONS: --openssl-legacy-provider + +jobs: + build-and-deploy: + if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')) || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + steps: + - name: 🏗 Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.head_ref }} + + - name: 🥟 Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version-file: '.bun-version' + + - name: Setup Node + uses: actions/setup-node@v4.1.0 + with: + node-version-file: .nvmrc + + - name: 📦 Install dependencies + run: bun install --frozen-lockfile + + - name: 📦 Install eas + run: | + bun instal eas-cli@latest + + - name: 📱 Setup EAS build cache + uses: actions/cache@v3 + with: + path: ~/.eas-build-local + key: ${{ runner.os }}-eas-build-local-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-eas-build-local- + + - name: 🔄 Verify EAS CLI installation + run: | + echo "EAS CLI version:" + eas --version + + - name: 📱 Build Development APK + if: github.event.inputs.buildType == 'all' || github.event.inputs.buildType == 'dev' || github.event_name == 'push' + run: | + # Build with increased memory limit + export NODE_OPTIONS="--openssl-legacy-provider --max_old_space_size=4096" + eas build --platform android --profile development --local --non-interactive --output=./app-dev.apk + env: + NODE_ENV: development + + - name: 📱 Build Production APK + if: github.event.inputs.buildType == 'all' || github.event.inputs.buildType == 'prod-apk' || github.event_name == 'push' + run: | + export NODE_OPTIONS="--openssl-legacy-provider --max_old_space_size=4096" + eas build --platform android --profile production --local --non-interactive --output=./app-prod.apk + env: + NODE_ENV: production + + - name: 📱 Build Production AAB + if: github.event.inputs.buildType == 'all' || github.event.inputs.buildType == 'prod-aab' || github.event_name == 'push' + run: | + export NODE_OPTIONS="--openssl-legacy-provider --max_old_space_size=4096" + eas build --platform android --profile production --local --non-interactive --output=./app-prod.aab + env: + NODE_ENV: production + + # - name: 🏗 Setup rclone + # uses: AnimMouse/setup-rclone@v1 + # with: + # version: latest + + # - name: 📤 Configure cloud storage + # run: | + # # Clean up any existing rclone config + # rm -rf ~/.config/rclone + + # # Create rclone config directory + # mkdir -p ~/.config/rclone + + # # Create rclone config file + # cat > ~/.config/rclone/rclone.conf << EOF + # [cloud] + # type = ${CLOUD_STORAGE_TYPE} + # region = com + # token = ${CLOUD_STORAGE_TOKEN} + # root_folder_id = ${CLOUD_STORAGE_ROOT_ID} + # EOF + + # # Set proper permissions + # chmod 600 ~/.config/rclone/rclone.conf + + # # Test configuration + # echo "Testing cloud storage configuration..." + # rclone ls cloud: --max-depth 1 + + # - name: 📤 Upload Development APK to cloud storage + # if: github.event.inputs.buildType == 'all' || github.event.inputs.buildType == 'dev' || github.event_name == 'push' + # run: | + # VERSION=$(node -p "require('./app.json').expo.version") + # BUILD_NUMBER=$(date +%Y%m%d%H%M) + # FOLDER_PATH="App Builds/$VERSION-$BUILD_NUMBER" + + # # Create directory first + # echo "Creating folder: $FOLDER_PATH" + # rclone mkdir "cloud:$FOLDER_PATH" + + # # Copy APK file + # echo "Uploading development APK..." + # rclone copy ./app-dev.apk "cloud:$FOLDER_PATH/app-dev-$VERSION-$BUILD_NUMBER.apk" -v + + # - name: 📤 Upload Production APK to cloud storage + # if: github.event.inputs.buildType == 'all' || github.event.inputs.buildType == 'prod-apk' || github.event_name == 'push' + # run: | + # VERSION=$(node -p "require('./app.json').expo.version") + # BUILD_NUMBER=$(date +%Y%m%d%H%M) + # FOLDER_PATH="App Builds/$VERSION-$BUILD_NUMBER" + + # echo "Uploading production APK..." + # rclone copy ./app-prod.apk "cloud:$FOLDER_PATH/app-prod-$VERSION-$BUILD_NUMBER.apk" -v + + # - name: 📤 Upload Production AAB to cloud storage + # if: github.event.inputs.buildType == 'all' || github.event.inputs.buildType == 'prod-aab' || github.event_name == 'push' + # run: | + # VERSION=$(node -p "require('./app.json').expo.version") + # BUILD_NUMBER=$(date +%Y%m%d%H%M) + # FOLDER_PATH="App Builds/$VERSION-$BUILD_NUMBER" + + # echo "Uploading production AAB..." + # rclone copy ./app-prod.aab "cloud:$FOLDER_PATH/app-prod-$VERSION-$BUILD_NUMBER.aab" -v + + # - name: 📦 Upload build artifacts to GitHub + # uses: actions/upload-artifact@v4 + # with: + # name: app-builds + # path: | + # ./app-dev.apk + # ./app-prod.apk + # ./app-prod.aab + # retention-days: 7