mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
* fix(ci): retry npm installs Transient registry and package-download failures should delay a job briefly instead of requiring a manual rerun. Apply one bounded retry policy across CI, deploy, and release workflows. * fix(ci): preserve retries for historical Android tags Manual Android rebuilds may check out releases from before the shared retry script existed. Keep that install step self-contained and allow the shared helper's injected runner to be asynchronous. * fix(ci): preserve retries for desktop release refs * refactor(ci): use shared npm retry helper everywhere
133 lines
4.0 KiB
YAML
133 lines
4.0 KiB
YAML
name: Android APK Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
- "android-v*"
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "Existing tag to build (e.g. v0.1.0)"
|
|
required: true
|
|
type: string
|
|
|
|
concurrency:
|
|
group: android-apk-release-${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
SOURCE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }}
|
|
|
|
jobs:
|
|
publish-android-apk:
|
|
permissions:
|
|
contents: write
|
|
packages: read
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref }}
|
|
|
|
- name: Resolve release tag
|
|
shell: bash
|
|
run: node scripts/emit-release-env.mjs --source-tag "$SOURCE_TAG" >> "$GITHUB_ENV"
|
|
|
|
- name: Ensure GitHub release exists
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
if gh release view "$RELEASE_TAG" --repo "${{ github.repository }}" >/dev/null 2>&1; then
|
|
exit 0
|
|
fi
|
|
|
|
release_args=(
|
|
release create "$RELEASE_TAG"
|
|
--repo "${{ github.repository }}"
|
|
--title "Paseo $RELEASE_TAG"
|
|
--notes ""
|
|
)
|
|
|
|
if [[ "$IS_PRERELEASE" == "true" ]]; then
|
|
release_args+=(--prerelease)
|
|
fi
|
|
|
|
if ! gh "${release_args[@]}"; then
|
|
echo "Release creation raced with another workflow; continuing."
|
|
fi
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
cache: "npm"
|
|
registry-url: "https://npm.pkg.github.com"
|
|
scope: "@boudra"
|
|
|
|
- name: Install JS dependencies
|
|
run: node scripts/npm-retry.mjs ci
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup Expo and EAS
|
|
uses: expo/expo-github-action@v8
|
|
with:
|
|
eas-version: latest
|
|
token: ${{ secrets.EXPO_TOKEN }}
|
|
|
|
- name: Build Android APK on EAS
|
|
id: eas_build
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
cd packages/app
|
|
|
|
build_json="$(npx eas build --platform android --profile production-apk --non-interactive --wait --json)"
|
|
echo "$build_json" > "$RUNNER_TEMP/eas-build.json"
|
|
|
|
build_id="$(jq -r 'if type == "array" then .[0].id // empty else .id // empty end' "$RUNNER_TEMP/eas-build.json")"
|
|
if [ -z "$build_id" ]; then
|
|
echo "Failed to determine EAS build ID."
|
|
cat "$RUNNER_TEMP/eas-build.json"
|
|
exit 1
|
|
fi
|
|
|
|
echo "build_id=$build_id" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Resolve APK artifact URL
|
|
id: artifact
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
cd packages/app
|
|
|
|
build_view_json="$(npx eas build:view '${{ steps.eas_build.outputs.build_id }}' --json)"
|
|
echo "$build_view_json" > "$RUNNER_TEMP/eas-build-view.json"
|
|
|
|
artifact_url="$(jq -r '.artifacts.buildUrl // .artifacts.applicationArchiveUrl // empty' "$RUNNER_TEMP/eas-build-view.json")"
|
|
if [ -z "$artifact_url" ]; then
|
|
echo "Failed to determine APK artifact URL."
|
|
cat "$RUNNER_TEMP/eas-build-view.json"
|
|
exit 1
|
|
fi
|
|
|
|
asset_name="paseo-${RELEASE_TAG}-android.apk"
|
|
asset_path="$RUNNER_TEMP/$asset_name"
|
|
|
|
curl --fail --location --output "$asset_path" "$artifact_url"
|
|
|
|
echo "asset_name=$asset_name" >> "$GITHUB_OUTPUT"
|
|
echo "asset_path=$asset_path" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Upload APK to GitHub Release
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh release upload "$RELEASE_TAG" "${{ steps.artifact.outputs.asset_path }}" --clobber --repo "${{ github.repository }}"
|