@@ -6,6 +6,49 @@ export const domain = (() => {
66
77export const zoneID = "430ba34c138cfb5360826c4909f99be8"
88
9+ const githubActionsDeployRole = ( ( ) => {
10+ if ( $app . stage !== "dev" && $app . stage !== "production" ) return
11+
12+ const provider = new aws . iam . OpenIdConnectProvider ( "GithubActionsOidcProvider" , {
13+ url : "https://token.actions.githubusercontent.com" ,
14+ clientIdLists : [ "sts.amazonaws.com" ] ,
15+ } )
16+ const role = new aws . iam . Role ( "GithubActionsDeployRole" , {
17+ name : `opencode-${ $app . stage } -github-actions-deploy` ,
18+ maxSessionDuration : 3600 ,
19+ assumeRolePolicy : aws . iam . getPolicyDocumentOutput ( {
20+ statements : [
21+ {
22+ effect : "Allow" ,
23+ actions : [ "sts:AssumeRoleWithWebIdentity" ] ,
24+ principals : [ { type : "Federated" , identifiers : [ provider . arn ] } ] ,
25+ conditions : [
26+ {
27+ test : "StringEquals" ,
28+ variable : "token.actions.githubusercontent.com:aud" ,
29+ values : [ "sts.amazonaws.com" ] ,
30+ } ,
31+ {
32+ test : "StringEquals" ,
33+ variable : "token.actions.githubusercontent.com:sub" ,
34+ values : [ `repo:anomalyco/opencode:environment:${ $app . stage } ` ] ,
35+ } ,
36+ ] ,
37+ } ,
38+ ] ,
39+ } ) . json ,
40+ } )
41+
42+ new aws . iam . RolePolicyAttachment ( "GithubActionsDeployRoleAdmin" , {
43+ role : role . name ,
44+ policyArn : "arn:aws:iam::aws:policy/AdministratorAccess" ,
45+ } )
46+
47+ return role
48+ } ) ( )
49+
50+ export const githubActionsDeployRoleArn = githubActionsDeployRole ?. arn
51+
952new cloudflare . RegionalHostname ( "RegionalHostname" , {
1053 hostname : domain ,
1154 regionKey : "us" ,
0 commit comments