Skip to content
Merged
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
3 changes: 1 addition & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Release and signing paths need the release owner's review. The branch ruleset on main and 0.22
# requires code-owner review and no other approvals, so other changes merge as before.
# Target: jobs that hold release secrets run only these paths. Until the Android helper signing
# split lands, the Build job in release.yml is the known exception. See docs/agents/pull-requests.md.
# Jobs that hold release secrets run only these paths. See docs/agents/pull-requests.md.
/.github/ @thymikee
/scripts/release-* @thymikee
/scripts/*android-helper* @thymikee
28 changes: 16 additions & 12 deletions .github/workflows/android-helper-signing-rehearsal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- 'scripts/build-android-helper.sh'
- 'scripts/package-android-helper.sh'
- 'scripts/check-unsigned-android-helper.mjs'
- 'scripts/rehearse-android-helper-signing.sh'
- 'scripts/sign-android-helpers.sh'
- 'scripts/release-version.mjs'

permissions: {}
Expand Down Expand Up @@ -59,6 +59,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
actions: read
contents: read
outputs:
artifact_id: ${{ steps.upload.outputs.artifact-id }}
Expand All @@ -72,19 +73,21 @@ jobs:
sparse-checkout: |
.github/actions/setup-android-sdk/action.yml
scripts/check-unsigned-android-helper.mjs
scripts/rehearse-android-helper-signing.sh
scripts/sign-android-helpers.sh
scripts/release-version.mjs
sparse-checkout-cone-mode: false
- name: Require the compiler artifact ID
# Fetched packed: actions/download-artifact extracts without a path containment check, and
# the compiler controls the entries. The signer unpacks only the expected APK names.
- name: Fetch unsigned helpers
env:
GH_TOKEN: ${{ github.token }}
ARTIFACT_ID: ${{ needs.compile-helpers.outputs.artifact_id }}
run: '[[ "$ARTIFACT_ID" =~ ^[0-9]+$ ]]'
- name: Download unsigned helpers
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
artifact-ids: ${{ needs.compile-helpers.outputs.artifact_id }}
path: ${{ runner.temp }}/unsigned-helpers
merge-multiple: true
run: |
set -euo pipefail
[[ "$ARTIFACT_ID" =~ ^[0-9]+$ ]]
artifact="repos/$GITHUB_REPOSITORY/actions/artifacts/$ARTIFACT_ID"
[ "$(gh api "$artifact" --jq .workflow_run.id)" = "$GITHUB_RUN_ID" ]
gh api "$artifact/zip" > "$RUNNER_TEMP/unsigned-helpers.zip"
- uses: ./.github/actions/setup-android-sdk
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
Expand All @@ -95,10 +98,11 @@ jobs:
id: sign
env:
VERSION: ${{ needs.compile-helpers.outputs.version }}
AGENT_DEVICE_ANDROID_HELPER_DISPOSABLE_KEY: '1'
run: |
set -euo pipefail
fingerprint="$(sh scripts/rehearse-android-helper-signing.sh "$VERSION" \
"$RUNNER_TEMP/unsigned-helpers" "$RUNNER_TEMP/signed-helpers")"
fingerprint="$(sh scripts/sign-android-helpers.sh "$VERSION" \
"$RUNNER_TEMP/unsigned-helpers.zip" "$RUNNER_TEMP/signed-helpers" snapshot ime)"
printf 'certificate=%s\n' "$fingerprint" >> "$GITHUB_OUTPUT"
- name: Upload signed helpers
id: upload
Expand Down
162 changes: 144 additions & 18 deletions .github/workflows/release-android-snapshot-helper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,28 @@ permissions:
contents: write

jobs:
publish-android-snapshot-helper:
name: Publish Android Snapshot Helper
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30
# The helper keystore secrets live only in the protected `release` environment. Its deployment
# rule gates github.ref, so the job builds exactly that ref.
environment: release
env:
AGENT_DEVICE_ANDROID_HELPER_RELEASE: '1'
# Compiles from the release ref with no secret. The release environment's deployment policy
# admits only main and v* tags, so the signer below never runs for another ref.
compile-helper:
name: Compile unsigned Android snapshot helper
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
# No Actions cache token: tag-source code cannot write the default-branch cache.
cache-mode: none
outputs:
artifact_id: ${{ steps.upload.outputs.artifact-id }}
version: ${{ steps.meta.outputs.version }}
steps:
- name: Checkout
uses: useblacksmith/checkout@2b9fe87d796feea153b455ec2f3125b471a7b0e7 # v1.8.2
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.ref }}
persist-credentials: false

- name: Checkout release validator
uses: useblacksmith/checkout@2b9fe87d796feea153b455ec2f3125b471a7b0e7 # v1.8.2
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: ${{ job.workflow_repository }}
ref: ${{ job.workflow_sha }}
Expand All @@ -48,6 +53,7 @@ jobs:
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: '24.13'
package-manager-cache: false

- name: Resolve release metadata
id: meta
Expand All @@ -65,25 +71,145 @@ jobs:
- name: Setup Android SDK
uses: ./.github/actions/setup-android-sdk

- name: Compile unsigned helper
Comment thread
thymikee marked this conversation as resolved.
Resolved
env:
VERSION: ${{ steps.meta.outputs.version }}
AGENT_DEVICE_ANDROID_HELPER_UNSIGNED: '1'
run: sh scripts/build-android-helper.sh snapshot "$VERSION" "$RUNNER_TEMP/unsigned-helpers"

- name: Upload unsigned helper
id: upload
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: unsigned-snapshot-helper-${{ inputs.release_tag }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/unsigned-helpers/*.apk
if-no-files-found: error
# Covers the environment approval window and reruns of later jobs.
retention-days: 30

# The only job that holds the helper keystore. It runs code from the workflow commit alone.
sign-helper:
name: Sign Android snapshot helper
needs: compile-helper
runs-on: ubuntu-latest
timeout-minutes: 10
environment: release
permissions:
actions: read
contents: read
outputs:
artifact_id: ${{ steps.upload.outputs.artifact-id }}
certificate: ${{ steps.sign.outputs.certificate }}
steps:
- name: Checkout signing tools
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: ${{ job.workflow_repository }}
ref: ${{ job.workflow_sha }}
persist-credentials: false
sparse-checkout: |
.github/actions/setup-android-sdk/action.yml
.github/actions/setup-android-helper-signing/action.yml
scripts/check-unsigned-android-helper.mjs
scripts/release-version.mjs
scripts/sign-android-helpers.sh
sparse-checkout-cone-mode: false

# Fetched packed: actions/download-artifact extracts without a path containment check, and
# the compiler controls the entries. The signer unpacks only the expected APK names.
- name: Fetch unsigned helpers
env:
GH_TOKEN: ${{ github.token }}
ARTIFACT_ID: ${{ needs.compile-helper.outputs.artifact_id }}
run: |
set -euo pipefail
[[ "$ARTIFACT_ID" =~ ^[0-9]+$ ]]
artifact="repos/$GITHUB_REPOSITORY/actions/artifacts/$ARTIFACT_ID"
[ "$(gh api "$artifact" --jq .workflow_run.id)" = "$GITHUB_RUN_ID" ]
gh api "$artifact/zip" > "$RUNNER_TEMP/unsigned-helpers.zip"

- name: Setup Android SDK
uses: ./.github/actions/setup-android-sdk

- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: '24.13'
package-manager-cache: false

- name: Setup Android helper signing
uses: ./.github/actions/setup-android-helper-signing
with:
keystore-base64: ${{ secrets.ANDROID_HELPER_KEYSTORE_BASE64 }}
keystore-password: ${{ secrets.ANDROID_HELPER_KEYSTORE_PASSWORD }}

- name: Check Java toolchain
- name: Check and sign helper
id: sign
env:
VERSION: ${{ needs.compile-helper.outputs.version }}
AGENT_DEVICE_ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_HELPER_KEYSTORE_PASSWORD }}
run: |
javac --version
java --version
set -euo pipefail
fingerprint="$(sh scripts/sign-android-helpers.sh "$VERSION" \
"$RUNNER_TEMP/unsigned-helpers.zip" "$RUNNER_TEMP/signed-helpers" snapshot)"
printf 'certificate=%s\n' "$fingerprint" >> "$GITHUB_OUTPUT"

- name: Upload signed helper
id: upload
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: signed-snapshot-helper-${{ inputs.release_tag }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/signed-helpers/*.apk
if-no-files-found: error
# Covers the environment approval window and reruns of later jobs.
retention-days: 30

publish-android-snapshot-helper:
name: Publish Android Snapshot Helper
needs: [compile-helper, sign-helper]
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 15
permissions:
contents: write
env:
AGENT_DEVICE_ANDROID_HELPER_RELEASE: '1'
AGENT_DEVICE_ANDROID_HELPER_CERTIFICATE_SHA256: ${{ needs.sign-helper.outputs.certificate }}
steps:
- name: Checkout
uses: useblacksmith/checkout@2b9fe87d796feea153b455ec2f3125b471a7b0e7 # v1.8.2
with:
ref: ${{ github.ref }}
persist-credentials: false

- name: Require the signed artifact ID
env:
ARTIFACT_ID: ${{ needs.sign-helper.outputs.artifact_id }}
run: '[[ "$ARTIFACT_ID" =~ ^[0-9]+$ ]]'

- name: Download signed helper
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
artifact-ids: ${{ needs.sign-helper.outputs.artifact_id }}
path: ${{ runner.temp }}/signed-helpers
merge-multiple: true

- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
Comment thread
thymikee marked this conversation as resolved.
Resolved
with:
node-version: '24.13'

# Exports AGENT_DEVICE_ANDROID_BUILD_TOOLS, which the helper packaging requires on CI.
- name: Setup Android SDK
uses: ./.github/actions/setup-android-sdk

- name: Package Android snapshot helper
id: package
env:
RELEASE_ASSET_DIR: ${{ github.workspace }}/.tmp/release-assets
RELEASE_VERSION: ${{ steps.meta.outputs.version }}
RELEASE_TAG: ${{ steps.meta.outputs.tag }}
RELEASE_VERSION: ${{ needs.compile-helper.outputs.version }}
RELEASE_TAG: ${{ inputs.release_tag }}
AGENT_DEVICE_ANDROID_HELPER: snapshot
AGENT_DEVICE_ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_HELPER_KEYSTORE_PASSWORD }}
AGENT_DEVICE_ANDROID_SIGNED_HELPERS_DIR: ${{ runner.temp }}/signed-helpers
run: |
set -euo pipefail
mkdir -p "${RELEASE_ASSET_DIR}"
Expand All @@ -99,7 +225,7 @@ jobs:
CHECKSUM_PATH: ${{ steps.package.outputs.checksum_path }}
MANIFEST_PATH: ${{ steps.package.outputs.manifest_path }}
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ steps.meta.outputs.tag }}
RELEASE_TAG: ${{ inputs.release_tag }}
run: |
set -euo pipefail
gh release upload "$RELEASE_TAG" \
Expand Down
Loading
Loading