Skip to content

Commit

Permalink
Export commited editId for further modifications (#233)
Browse files Browse the repository at this point in the history
* Add uploadEditId as output and as environment variable

* Export commitedEditIdExpiryTimeSeconds as output and as environment variable

* Update README.md
  • Loading branch information
Swisyn authored Nov 4, 2024
1 parent 08b898d commit 75bf79c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ This action will help you upload an Android `.apk` or `.aab` (Android App Bundle
| --- | --- | --- |
| internalSharingDownloadUrls | INTERNAL_SHARING_DOWNLOAD_URLS | A JSON list containing the download urls for every release file uploaded using the `internalsharing` track |
| internalSharingDownloadUrl | INTERNAL_SHARING_DOWNLOAD_URL | The download url for the last release file uploaded using the `internalsharing` track |
committedEditId | COMMITTED_EDIT_ID | The unique identifier of the committed edit. |
committedEditIdExpiryTimeSeconds | COMMITTED_EDIT_ID_EXPIRY_TIME_SECONDS | Time in seconds until the committed edit expires. |


## Example usage

Expand Down
10 changes: 8 additions & 2 deletions src/edits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export async function runUpload(

async function uploadToPlayStore(options: EditOptions, releaseFiles: string[]): Promise<string | void> {
const internalSharingDownloadUrls: string[] = []

// Check the 'track' for 'internalsharing', if so switch to a non-track api
if (options.track === 'internalsharing') {
core.debug("Track is Internal app sharing, switch to special upload api")
Expand Down Expand Up @@ -115,6 +114,13 @@ async function uploadToPlayStore(options: EditOptions, releaseFiles: string[]):
// Simple check to see whether commit was successful
if (res.data.id) {
core.info(`Successfully committed ${res.data.id}`);

core.setOutput("committedEditId", res.data.id);
core.setOutput("commitedEditIdExpiryTimeSeconds", res.data.expiryTimeSeconds);

core.exportVariable("COMMITED_EDIT_ID", res.data.id);
core.exportVariable("COMMITED_EDIT_ID_EXPIRY_IN_TIME_SECONDS", res.data.expiryTimeSeconds);

return res.data.id
} else {
core.setFailed(`Error ${res.status}: ${res.statusText}`);
Expand Down Expand Up @@ -411,4 +417,4 @@ function inferInternalSharingDownloadUrl(
versionCode: number
) {
return `https://play.google.com/apps/test/${applicationId}/${versionCode}`;
}
}

0 comments on commit 75bf79c

Please sign in to comment.