-
Notifications
You must be signed in to change notification settings - Fork 135
Expand file tree
/
Copy pathrelease-android-snapshot-helper.yml
More file actions
94 lines (85 loc) · 3.1 KB
/
release-android-snapshot-helper.yml
File metadata and controls
94 lines (85 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Release Android Snapshot Helper
on:
release:
types:
- published
workflow_dispatch:
inputs:
release_tag:
description: GitHub Release tag to upload assets to, for example v0.13.3.
required: true
type: string
checkout_ref:
description: Optional branch, tag, or commit SHA to build. Defaults to the selected workflow ref.
required: false
type: string
permissions:
contents: write
jobs:
publish-android-snapshot-helper:
name: Publish Android Snapshot Helper
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.inputs.checkout_ref || github.ref }}
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: "22"
- name: Install Android SDK packages
run: |
SDK_ROOT="${ANDROID_HOME:-${ANDROID_SDK_ROOT:-/usr/local/lib/android/sdk}}"
SDKMANAGER="$SDK_ROOT/cmdline-tools/latest/bin/sdkmanager"
if [ ! -x "$SDKMANAGER" ]; then
SDKMANAGER="$SDK_ROOT/cmdline-tools/bin/sdkmanager"
fi
if [ ! -x "$SDKMANAGER" ]; then
echo "sdkmanager not found under $SDK_ROOT" >&2
exit 1
fi
yes | "$SDKMANAGER" --licenses >/dev/null
"$SDKMANAGER" "platforms;android-36" "build-tools;36.0.0"
- name: Check Java toolchain
run: |
javac --version
java --version
- name: Resolve release metadata
id: meta
run: |
set -euo pipefail
PACKAGE_VERSION="$(node -p "JSON.parse(require('node:fs').readFileSync('package.json', 'utf8')).version")"
TAG_NAME="${{ github.event.release.tag_name || github.event.inputs.release_tag }}"
VERSION="${TAG_NAME#v}"
if [ "$VERSION" != "$PACKAGE_VERSION" ]; then
echo "Release tag $TAG_NAME does not match package.json version $PACKAGE_VERSION" >&2
exit 1
fi
echo "tag=$TAG_NAME" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
shell: bash
- name: Package Android snapshot helper
id: package
env:
RELEASE_ASSET_DIR: ${{ github.workspace }}/.tmp/release-assets
run: |
set -euo pipefail
mkdir -p "${RELEASE_ASSET_DIR}"
sh ./scripts/package-android-snapshot-helper.sh \
"${{ steps.meta.outputs.version }}" \
"${{ steps.meta.outputs.tag }}" \
"${RELEASE_ASSET_DIR}"
shell: bash
- name: Upload helper assets to GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
gh release upload "${{ steps.meta.outputs.tag }}" \
"${{ steps.package.outputs.apk_path }}" \
"${{ steps.package.outputs.checksum_path }}" \
"${{ steps.package.outputs.manifest_path }}" \
--clobber
shell: bash