mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-07-11 21:09:37 +02:00
156 lines
5.3 KiB
YAML
156 lines
5.3 KiB
YAML
name: Notesnook Android Preview
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, reopened, synchronize]
|
|
branches: [master, beta]
|
|
paths:
|
|
- "apps/mobile/**"
|
|
- "packages/**"
|
|
# re-run workflow if workflow file changes
|
|
- ".github/workflows/android.preview.firebase.yml"
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-22.04
|
|
env:
|
|
STAGING_BUILD: true
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup Node
|
|
uses: ./.github/actions/setup-node-with-cache
|
|
|
|
- name: Use specific Java version for the builds
|
|
uses: joschi/setup-jdk@v2
|
|
with:
|
|
java-version: "17"
|
|
architecture: "x64"
|
|
|
|
- name: Free Disk Space (Ubuntu)
|
|
uses: jlumbroso/free-disk-space@main
|
|
with:
|
|
# this might remove tools that are actually needed,
|
|
# if set to "true" but frees about 6 GB
|
|
tool-cache: false
|
|
|
|
# all of these default to true, but feel free to set to
|
|
# "false" if necessary for your workflow
|
|
android: false
|
|
dotnet: true
|
|
haskell: true
|
|
large-packages: true
|
|
docker-images: true
|
|
swap-storage: true
|
|
|
|
- name: Install node modules
|
|
run: |
|
|
npm ci --ignore-scripts --prefer-offline --no-audit
|
|
npm run bootstrap -- --scope=mobile
|
|
|
|
- name: Generate dependency hash
|
|
id: dep-hash
|
|
run: |
|
|
DEPS_HASH=$(node -e "
|
|
const pkg = require('./apps/mobile/package.json');
|
|
const crypto = require('crypto');
|
|
const depsStr = JSON.stringify(pkg.dependencies);
|
|
const hash = crypto.createHash('md5').update(depsStr).digest('hex');
|
|
console.log(hash);
|
|
")
|
|
echo "hash=$DEPS_HASH" >> $GITHUB_OUTPUT
|
|
|
|
- name: Cache Android build files
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.gradle/caches
|
|
~/.gradle/wrapper
|
|
apps/mobile/android/.gradle
|
|
apps/mobile/android/build
|
|
apps/mobile/android/app/build
|
|
apps/mobile/android/app/.cxx
|
|
node_modules/**/android/build
|
|
node_modules/**/android/.cxx
|
|
node_modules/**/android/generated
|
|
node_modules/**/.gradle
|
|
node_modules/**/.cxx
|
|
key: android-build-${{ runner.os }}-deps-${{ steps.dep-hash.outputs.hash }}
|
|
restore-keys: |
|
|
android-build-${{ runner.os }}-
|
|
|
|
- name: Make Gradlew Executable
|
|
run: cd apps/mobile/android && chmod +x ./gradlew
|
|
|
|
- name: Get build number
|
|
id: build-number
|
|
run: echo "timestamp=$(($(date +%s) - 1774851180 ))" >> $GITHUB_OUTPUT
|
|
|
|
# - name: Check for typescript errors
|
|
# run: |
|
|
# npm run tx mobile:build
|
|
# cd apps/mobile
|
|
# npx tsc --noEmit
|
|
|
|
- name: Build arm64-v8a apk
|
|
run: |
|
|
cd apps/mobile/android
|
|
./gradlew assembleRelease -PreactNativeArchitectures=arm64-v8a -PstagingReleaseBuild=true -PprBuildNumber=${{ steps.build-number.outputs.timestamp }}
|
|
|
|
# - name: Get app version
|
|
# id: package-version
|
|
# uses: saionaro/extract-package-version@master
|
|
# with:
|
|
# path: apps/mobile
|
|
|
|
# - name: Publish to firebase CLI
|
|
# id: firebase-output
|
|
# uses: wzieba/Firebase-Distribution-Github-Action@v1
|
|
# with:
|
|
# appId: ${{secrets.FIREBASE_APP_ID}}
|
|
# serviceCredentialsFileContent: ${{ secrets.QA_SERVICE_ACCOUNT }}
|
|
# groups: testers
|
|
# file: apps/mobile/android/app/build/outputs/apk/release/app-arm64-v8a-release.apk
|
|
# releaseNotes: Preview for https://github.com/streetwriters/notesnook/pull/${{github.event.number}}
|
|
|
|
# - name: Post or update PR comment
|
|
# uses: actions/github-script@v6
|
|
# env:
|
|
# preview_url: ${{ steps.firebase-output.outputs.TESTING_URI }}
|
|
# with:
|
|
# script: |
|
|
# const marker = '<!-- android-preview-comment -->';
|
|
# const prNumber = context.issue.number;
|
|
# const previewUrl = process.env.preview_url || '';
|
|
# const body = `${marker}\n**Android App Preview**\n\n${previewUrl || 'Preview URL unavailable — check workflow logs.'}\n\nCommit: ${process.env.GITHUB_SHA}\n`;
|
|
# const { data: comments } = await github.rest.issues.listComments({
|
|
# owner: context.repo.owner,
|
|
# repo: context.repo.repo,
|
|
# issue_number: prNumber,
|
|
# });
|
|
# const existing = comments.find(c => c.body && c.body.includes(marker));
|
|
# if (existing) {
|
|
# await github.rest.issues.updateComment({
|
|
# owner: context.repo.owner,
|
|
# repo: context.repo.repo,
|
|
# comment_id: existing.id,
|
|
# body,
|
|
# });
|
|
# } else {
|
|
# await github.rest.issues.createComment({
|
|
# owner: context.repo.owner,
|
|
# repo: context.repo.repo,
|
|
# issue_number: prNumber,
|
|
# body,
|
|
# });
|
|
# }
|
|
|
|
# - name: Upload sourcemaps
|
|
# uses: actions/upload-artifact@v4
|
|
# with:
|
|
# name: sourcemaps
|
|
# path: |
|
|
# apps/mobile/android/app/build/generated/sourcemaps/**/*.map
|