Skip to content
Merged

nb #51

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 16 additions & 44 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Build

on:
push:
branches:
Expand All @@ -14,6 +15,7 @@ jobs:
name: Build App
runs-on: ubuntu-latest
timeout-minutes: 60

steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -41,54 +43,24 @@ jobs:
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: false

- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Create Environment File
run: |
cat > .env << EOF
MYANIMELIST_CLIENT_ID=${{ vars.MYANIMELIST_CLIENT_ID }}
ANILIST_CLIENT_ID=${{ vars.ANILIST_CLIENT_ID }}
GIT_HASH=$(git rev-parse --short HEAD)
RELEASE_DATE=$(date --utc +'%d/%m/%y %I:%M %p %Z')
BUILD_TYPE=Github Action
EOF

- name: Make Gradlew Executable
run: cd android && chmod +x ./gradlew

- name: Set Environment Variables
run: |
set -x
echo "COMMIT_COUNT=$(git rev-list --count HEAD)" >> $GITHUB_ENV
echo "COMMIT_ID=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Build Android Release
env:
COMMIT_COUNT: ${{ env.COMMIT_COUNT }}
COMMIT_ID: ${{ env.COMMIT_ID }}
- name: Generate Environment Variables
run: |
sed -i 's/lnreader/lnreader-r${{ env.COMMIT_COUNT }}(${{ env.COMMIT_ID }})/g' android/app/src/main/res/values/strings.xml
cd android && ./gradlew assembleRelease -PcustomAppId=com.rajarsheechatterjee.LNReader.commit_${{ env.COMMIT_ID }} --build-cache
mv app/build/outputs/apk/release/app-release.apk app/build/outputs/apk/release/LNReader-r${{ env.COMMIT_COUNT }}-${{ env.COMMIT_ID }}.apk
pnpm generate:env:release \
--build-type "Github Action" \
--node-env "production" \
--myanimelist-client-id "${{ vars.MYANIMELIST_CLIENT_ID }}" \
--anilist-client-id "${{ vars.ANILIST_CLIENT_ID }}"

- name: Upload Release Artifact
- name: Build Android Release with Rock
uses: callstackincubator/android@v3
env:
COMMIT_COUNT: ${{ env.COMMIT_COUNT }}
COMMIT_ID: ${{ env.COMMIT_ID }}
uses: actions/upload-artifact@v4
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_OWNER: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
with:
name: LNReader-r${{ env.COMMIT_COUNT }}-${{ env.COMMIT_ID }}
path: android/app/build/outputs/apk/release/LNReader-r${{ env.COMMIT_COUNT }}-${{ env.COMMIT_ID }}.apk
retention-days: 30
re-sign: true
github-token: ${{ secrets.GITHUB_TOKEN }}
variant: preRelease
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ npm-debug.*
*.mobileprovision
*.orig.*
web-build/
.env
.*env
reader_playground/index.html
# macOS
.DS_Store
Expand Down Expand Up @@ -89,8 +89,13 @@ flake.lock
# pnpm
.pnpm-store

src/generated/**/*

.cursor/
.agents/
.claude/
.jj/
.sisyphus/

# Rock
.rock/
17 changes: 14 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ react {
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
// codegenDir = file("../../node_modules/@react-native/codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
// cliFile = file("../../node_modules/react-native/cli.js")
cliFile = file("../../node_modules/rock/dist/src/bin.js")

/* Variants */
// The list of variants to that are debuggable. For those we're going to
Expand Down Expand Up @@ -84,7 +84,7 @@ android {
compileSdk rootProject.ext.compileSdkVersion
namespace "com.rajarsheechatterjee.LNReader"
defaultConfig {
applicationId project.hasProperty('customAppId') ? project.getProperty('customAppId') : 'com.rajarsheechatterjee.LNReader'
applicationId 'com.rajarsheechatterjee.LNReader'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
// Generated version code. Supports versions up to 1024.1024.2048
Expand All @@ -105,6 +105,17 @@ android {
applicationIdSuffix 'debug'
versionNameSuffix '-debug'
}
preRelease {
initWith release
matchingFallbacks = ["release"]
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
applicationIdSuffix 'preRelease'
versionNameSuffix '-pre-release'
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
Expand Down Expand Up @@ -134,4 +145,4 @@ dependencies {
} else {
implementation jscFlavor
}
}
}
4 changes: 2 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ plugins {

extensions.configure(com.facebook.react.ReactSettingsExtension) { ex ->
if (System.getenv('EXPO_USE_COMMUNITY_AUTOLINKING') == '1') {
ex.autolinkLibrariesFromCommand()
ex.autolinkLibrariesFromCommand(['npx', 'rock', 'config', '-p', 'android'])
} else {
ex.autolinkLibrariesFromCommand(expoAutolinking.rnConfigCommand)
ex.autolinkLibrariesFromCommand(['npx', 'rock', 'config', '-p', 'android'])
}
}

Expand Down
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default function (api) {
'@type': './src/type',
'@specs': './specs',
'@test-utils': './__tests-modules__/test-utils',
'@env': './src/generated/build-info',
'react-native-vector-icons/MaterialCommunityIcons':
'@react-native-vector-icons/material-design-icons',
},
Expand Down
12 changes: 0 additions & 12 deletions env.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion ios/LNReader.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
shellScript = "set -e\nif [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\nsource \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\nsource \"$PODS_ROOT/../.xcode.env.local\"\nfi\nexport CONFIG_CMD=\"dummy-workaround-value\"\nexport CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('rock/package.json')) + '/dist/src/bin.js'\")\"\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\n";
};
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ target 'LNReader' do
]
end

config = use_native_modules!(config_command)
config = use_native_modules!(['npx', 'rock', 'config', '-p', 'ios'])(config_command)

use_react_native!(
:path => config[:reactNativePath],
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const baseModuleNameMapper = {
'^@type/(.*)$': '<rootDir>/src/type/$1',
'^@specs/(.*)$': '<rootDir>/specs/$1',
'^@test-utils$': '<rootDir>/__tests-modules__/test-utils',
'^@env$': '<rootDir>/src/generated/build-info',
// Mock static assets
'\\.(jpg|jpeg|png|gif|webp|svg)$': '<rootDir>/__mocks__/fileMock.js',
};
Expand Down
24 changes: 13 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"version": "2.0.3",
"private": true,
"scripts": {
"dev:android": "pnpm run generate:env:debug && react-native run-android --appIdSuffix \"debug\" --active-arch-only",
"dev:android:release": "pnpm run generate:env:release && react-native run-android --mode \"release\" --active-arch-only",
"dev:ios": "react-native run-ios",
"dev:start": "react-native start",
"dev:android:release": "pnpm run generate:env:release && rock run:android --variant \"release\" --active-arch-only",
"dev:android": "pnpm run generate:env:debug && rock run:android --app-id-suffix \"debug\" --active-arch-only",
"dev:ios": "rock run:ios",
"dev:start": "rock start",
"dev:clean-start": "pnpm run dev:start -- --reset-cache",
"build:release:android": "pnpm run generate:env:release && cd android && ./gradlew clean && ./gradlew assembleRelease",
"build:release:android": "pnpm run generate:env:release && rock build:android --variant \"release\"",
"build:open-apk": "open ./android/app/build/outputs/apk/release/",
"generate:env:debug": "node scripts/generate-env-file.cjs Debug",
"generate:env:release": "node scripts/generate-env-file.cjs Release",
"generate:env:debug": "node scripts/generate-env-file.cjs --build-type Debug",
"generate:env:release": "node scripts/generate-env-file.cjs --build-type Release",
"generate:string-types": "node scripts/generate-string-types.cjs",
"generate:db-migration": "drizzle-kit generate",
"upgrade:migration-format": "drizzle-kit up",
Expand Down Expand Up @@ -67,6 +67,7 @@
"@react-navigation/native": "^7.2.2",
"@react-navigation/native-stack": "^7.14.10",
"@react-navigation/stack": "^7.8.9",
"@shopify/flash-list": "^2.3.1",
"babel-plugin-inline-import": "^3.0.0",
"cheerio": "1.0.0-rc.12",
"color": "^5.0.3",
Expand Down Expand Up @@ -94,7 +95,6 @@
"react": "^19.2.4",
"react-native": "^0.83.4",
"react-native-background-actions": "^4.0.1",
"react-native-config": "^1.6.1",
"react-native-device-info": "^15.0.2",
"react-native-draggable-flatlist": "^4.0.3",
"react-native-drawer-layout": "^4.2.2",
Expand Down Expand Up @@ -125,14 +125,15 @@
"@babel/plugin-transform-export-namespace-from": "^7.27.1",
"@babel/preset-env": "^7.29.2",
"@babel/runtime": "^7.29.2",
"@react-native-community/cli": "^20.1.3",
"@react-native-community/cli-platform-android": "^20.1.3",
"@react-native-community/cli-platform-ios": "^20.1.3",
"@react-native/babel-preset": "^0.83.4",
"@react-native/eslint-config": "^0.83.4",
"@react-native/eslint-plugin": "^0.83.4",
"@react-native/metro-config": "^0.83.4",
"@react-native/typescript-config": "^0.83.4",
"@rock-js/platform-android": "^0.12.12",
"@rock-js/platform-ios": "^0.12.12",
"@rock-js/plugin-metro": "^0.12.12",
"@rock-js/provider-github": "^0.12.12",
"@testing-library/react-native": "^13.3.3",
"@types/better-sqlite3": "^7.6.13",
"@types/color": "^4.2.1",
Expand Down Expand Up @@ -161,6 +162,7 @@
"lint-staged": "^12.5.0",
"prettier": "2.8.8",
"react-test-renderer": "19.2.4",
"rock": "^0.12.12",
"typescript": "~5.9.3"
},
"lint-staged": {
Expand Down
Loading
Loading