Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CD] Add skip hp publish flag #6

Merged
merged 2 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
29 changes: 17 additions & 12 deletions src/commands/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export default class Publish extends Command {
'web': flags.web,
'darwin_amd64': flags.darwin_amd64,
'darwin_arm64': flags.darwin_arm64,
'windows_amd64': flags.windows_amd64
'windows_amd64': flags.windows_amd64,
'skip_hyperplay_publish': flags.skip_hyperplay_publish
}

static args = [
Expand Down Expand Up @@ -97,10 +98,8 @@ export default class Publish extends Command {
const privateKey = flags['private-key'] || await select();
const metaTx = flags['meta-tx'];

const apiURL = 'https://developers.hyperplay.xyz'
const wallet = new ethers.Wallet(privateKey);
const cookieJar = Publish.cookieJar ?? new CookieJar();
const apiClient = wrapper(axios.create({ jar: cookieJar, withCredentials: true, baseURL: apiURL }));

const provider = await this.provider(flags.network, privateKey);
const valist = await create(provider, { metaTx });
Expand Down Expand Up @@ -137,17 +136,23 @@ export default class Publish extends Command {
await tx.wait();
CliUx.ux.action.stop();

await loginAndPublish(
apiClient, cookieJar, wallet, apiURL, projectID,
fullReleaseName
);
// Publish to HyperPlay
if (!flags['skip_hyperplay_publish']){
const apiURL = 'https://developers.hyperplay.xyz'
const apiClient = wrapper(axios.create({ jar: cookieJar, withCredentials: true, baseURL: apiURL }));
await loginAndPublish(
apiClient, cookieJar, wallet, apiURL, projectID,
fullReleaseName
);
}

CliUx.ux.log(`Successfully published ${config.account}/${config.project}/${config.release}!`);
CliUx.ux.log(`view the release at:
https://developers.hyperplay.xyz/${config.account}/${config.project}/settings
${release.external_url}
ipfs://${release.external_url.replace('https://gateway.valist.io/ipfs/', '')}
`);
let releaseText = 'view the release at:\n'
if (!flags['skip_hyperplay_publish'])
releaseText += `https://developers.hyperplay.xyz/${config.account}/${config.project}/settings\n`
releaseText += release.external_url + '\n'
releaseText += `ipfs://${release.external_url.replace('https://gateway.valist.io/ipfs/', '')}\n`
CliUx.ux.log(releaseText);

this.exit(0);
}
Expand Down
6 changes: 6 additions & 0 deletions src/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,9 @@ export const android_arm64 = Flags.string({
env: 'HYPERPLAY_ANDROID_AMD64_BUILD',
default: ''
});

export const skip_hyperplay_publish = Flags.boolean({
description: 'Do not publish to HyperPlay. Only Valist.',
allowNo: true,
default: false,
});
BrettCleary marked this conversation as resolved.
Show resolved Hide resolved