-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(ci): test alternate ci/cd workflow
- Loading branch information
Showing
1 changed file
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected] | ||
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 |