Skip to content

Commit 7e5ffc1

Browse files
committed
fix: rename custom-ref to custom-identifier, add validation
1 parent a460cf7 commit 7e5ffc1

2 files changed

Lines changed: 35 additions & 5 deletions

File tree

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,33 @@ jobs:
6969
| `keystore-path` | where the keystore should be placed | No | `release.keystore` |
7070
| `rock-build-extra-params` | Extra parameters for rock build:android | No | - |
7171
| `comment-bot` | Whether to comment PR with build link | No | `true` |
72-
| `custom-ref` | Custom app reference for artifact naming | No | - |
72+
| `custom-identifier` | Custom identifier used in artifact naming for re-sign and ad-hoc flows to distinguish builds with the same native fingerprint | No | - |
73+
74+
## Artifact Naming
75+
76+
The action uses two distinct naming strategies for uploads:
77+
78+
### ZIP Artifacts (native build caching)
79+
80+
ZIP artifacts store the native build for reuse. The naming depends on the flow:
81+
82+
- **Ad-hoc flow** (`ad-hoc: true`): ZIP name uses **fingerprint only**`rock-android-{variant}-{fingerprint}`. One ZIP per fingerprint, shared across all builds with the same native code. Skipped if already uploaded.
83+
- **Non-ad-hoc re-sign flow** (e.g. `pull_request` with `re-sign: true`): ZIP name includes an **identifier**`rock-android-{variant}-{identifier}-{fingerprint}`. Used as the distribution mechanism without adhoc builds.
84+
- **Regular builds** (no `re-sign`): ZIP name uses **fingerprint only** `rock-android-{variant}-{fingerprint}`
85+
86+
### Ad-Hoc Artifacts (distribution to testers)
87+
88+
When `ad-hoc: true`, distribution files (APK + `index.html`) are uploaded under a name that **always includes an identifier**: `rock-android-{variant}-{identifier}-{fingerprint}`. This ensures every uploaded adhoc build can point to unique distribution URL based on `{identifier}`, even when multiple builds share the same native fingerprint.
89+
90+
### Identifier Priority
91+
92+
The identifier distinguishes builds that share the same native fingerprint (e.g., concurrent builds from different branches).
93+
It is resolved in this order:
94+
1. `custom-identifier` input — explicit value provided by the caller (e.g., commit SHA of the head of the PR branch)
95+
2. PR number — automatically extracted from `pull_request` events
96+
3. Short commit SHA — 7-character fallback for push events and dispatches
97+
98+
> **Note:** The identifier becomes part of artifact names and S3 paths. Allowed characters: `a-z`, `A-Z`, `0-9`, `-`, `.`, `_`. Commas are used internally as trait delimiters and converted to hyphens (e.g., `debug,42``debug-42`), so they must not appear in the identifier. Spaces, slashes, and shell metacharacters are also not allowed.
7399
74100
## Outputs
75101

action.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ inputs:
6868
description: 'Whether to send a comment under PR with the link to the generated build'
6969
required: false
7070
default: true
71-
custom-ref:
72-
description: 'Custom app reference for artifact naming'
71+
custom-identifier:
72+
description: 'Custom identifier used in artifact naming for re-sign and ad-hoc flows to distinguish builds with the same native fingerprint'
7373
required: false
7474

7575
outputs:
@@ -293,8 +293,12 @@ runs:
293293
- name: Set Identifier
294294
if: ${{ inputs.re-sign == 'true' || inputs.ad-hoc == 'true' }}
295295
run: |
296-
if [ -n "${{ inputs.custom-ref }}" ]; then
297-
IDENTIFIER="${{ inputs.custom-ref }}"
296+
if [ -n "${{ inputs.custom-identifier }}" ]; then
297+
IDENTIFIER="${{ inputs.custom-identifier }}"
298+
if ! echo "$IDENTIFIER" | grep -qE '^[a-zA-Z0-9._-]+$'; then
299+
echo "Invalid 'custom-identifier': '$IDENTIFIER'. Use only alphanumeric characters, hyphens, dots, and underscores."
300+
exit 1
301+
fi
298302
elif [ "${{ github.event_name }}" = "pull_request" ]; then
299303
IDENTIFIER="${{ github.event.pull_request.number }}"
300304
else

0 commit comments

Comments
 (0)