import { QumoClient } from "@qumo-deploy/sdk";
const client = new QumoClient({
baseUrl: "https://api.qumo-deploy.com",
token: process.env.QUMO_TOKEN!,
});
async function setupCiIdentity(projectId: string) {
// 1. Create an identity principal
const identity = await client.identities.create(projectId, "github-actions-deployer");
// 2. Grant it a role on the project
await client.iam.createBinding(projectId, {
principal_type: "identity",
principal_id: identity.id,
role_id: "roles/project.admin",
scope_type: "project",
scope_id: projectId,
});
// 3. Mint a token for the pipeline. `value` is shown only once:
// store it as the CI secret QUMO_TOKEN.
const token = await client.identities.createToken(projectId, identity.id);
console.log(`Identity ${identity.id} created; token ${token.id}`);
}