@alchemy
GitHub 为 炼金术。在您的 CI 部署的基础设施中, 在同一 TypeScript 程序中, 宣告寄存器、 动作秘密和变量、 环境、 网点和分支保护 .
npm install alchemy @alchemy.run/github effect
拥有变量的存储器,其部署工作流程需要:
// alchemy.run.ts
import * as Alchemy from "alchemy";
import * as GitHub from "@alchemy.run/github";
import * as Effect from "effect/Effect";
export default Alchemy.Stack(
"MyRepos",
{
providers: GitHub.providers(),
state: Alchemy.localState(),
},
Effect.gen(function* () {
const repo = yield* GitHub.Repository("api", {
owner: "my-org",
name: "api",
description: "API service",
autoInit: true,
deleteBranchOnMerge: true,
});
yield* GitHub.Variables({
owner: "my-org",
repository: "api",
variables: { AWS_REGION: "us-east-1" },
});
yield* GitHub.Environment("production", {
owner: "my-org",
repository: "api",
name: "production",
reviewers: { teams: ["platform"] },
});
return { url: repo.htmlUrl };
}),
);
其他提供者的产出直接流入:通过角色ARN @alchemy.run/aws 作为变量,或 Axiom 摄入标志作为秘密, 他们保持同步 在每次部署.