fix(Android): Fix back button on android #1375
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
name: Generate App Installers | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, edited] | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build-installers: | |
permissions: write-all | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: "macos-latest" | |
- platform: "ubuntu-latest" | |
- platform: "windows-latest" | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/[email protected] | |
- name: setup node | |
uses: actions/[email protected] | |
with: | |
node-version: lts/* | |
- name: install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
- name: install dependencies (ubuntu only) | |
if: matrix.platform == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | |
- name: install frontend dependencies | |
run: npm install | |
- uses: tauri-apps/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Ubuntu installer | |
if: matrix.platform == 'ubuntu-latest' | |
uses: actions/[email protected] | |
with: | |
name: build-ubuntu | |
path: src-tauri/target/release/bundle/deb/*.deb | |
retention-days: 5 | |
- name: Build Web Assets 🔨 | |
if: matrix.platform == 'ubuntu-latest' | |
run: npm run build | |
- name: Set up JDK | |
if: matrix.platform == 'ubuntu-latest' | |
uses: actions/[email protected] | |
with: | |
distribution: "temurin" | |
java-version: "21" | |
- name: Set up Android SDK | |
if: matrix.platform == 'ubuntu-latest' | |
uses: android-actions/[email protected] | |
- name: Sync Capacitor Assets 🔨 | |
if: matrix.platform == 'ubuntu-latest' | |
run: npx cap sync && npx cap copy android && cd android && ./gradlew assembleDebug | |
- name: Upload APK | |
if: matrix.platform == 'ubuntu-latest' | |
uses: actions/[email protected] | |
with: | |
name: build-android | |
path: android/app/build/outputs/apk/debug/app-debug.apk | |
retention-days: 5 | |
- name: Upload macOS installer | |
if: matrix.platform == 'macos-latest' | |
uses: actions/[email protected] | |
with: | |
name: build-macos | |
path: src-tauri/target/release/bundle/dmg/*.dmg | |
retention-days: 5 | |
- name: Upload MSI installer | |
if: matrix.platform == 'windows-latest' | |
uses: actions/[email protected] | |
with: | |
name: build-windows | |
path: src-tauri/target/release/bundle/msi/*.msi | |
retention-days: 5 | |
- name: Post Download Links for Artifacts | |
if: success() | |
uses: actions/[email protected] | |
with: | |
script: | | |
async function upsertComment(owner, repo, issue_number, purpose, body) { | |
const {data: comments} = await github.rest.issues.listComments( | |
{owner, repo, issue_number}); | |
const marker = `<!-- bot: ${purpose} -->`; | |
body = marker + "\n" + body; | |
const existing = comments.filter((c) => c.body.includes(marker)); | |
if (existing.length > 0) { | |
const last = existing[existing.length - 1]; | |
console.info(`Updating comment ${last.id}`); | |
await github.rest.issues.updateComment({ | |
owner, repo, | |
body, | |
comment_id: last.id, | |
}); | |
} else { | |
console.info(`Creating a comment in issue / PR #${issue_number}`); | |
await github.rest.issues.createComment({issue_number, body, owner, repo}); | |
} | |
} | |
const {owner, repo} = context.repo; | |
const run_id = ${{github.run_id}}; // Use current run id | |
const pull_requests = ${{ toJSON(github.event.pull_request) }}; | |
if (!pull_requests) { | |
return core.error("This workflow doesn't match any pull requests!"); | |
} | |
const artifacts = await github.paginate( | |
github.rest.actions.listWorkflowRunArtifacts, {owner, repo, run_id}); | |
if (!artifacts.length) { | |
return core.error(`No artifacts found`); | |
} | |
let body = `Download the app installers for this pull request:\n`; | |
for (const art of artifacts) { | |
body += `\n* [${art.name}.zip](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`; | |
} | |
console.info("Review thread message body:", body); | |
await upsertComment(owner, repo, pull_requests.number, | |
"nightly-link", body); |