declapract-typescript-ehmpathy 0.43.19 → 0.44.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. package/dist/practices/cicd-app-react-native-expo/best-practice/.github/workflows/.deploy-expo.yml +16 -42
  2. package/dist/practices/cicd-app-react-native-expo/best-practice/.github/workflows/deploy.yml +6 -13
  3. package/dist/practices/cicd-common/best-practice/.github/workflows/.declastruct.yml +32 -4
  4. package/dist/practices/cicd-common/best-practice/.github/workflows/.test.yml +22 -41
  5. package/dist/practices/cicd-common/best-practice/.github/workflows/release.yml +46 -3
  6. package/dist/practices/{cicd-package → cicd-common}/best-practice/.github/workflows/test.yml +4 -1
  7. package/dist/practices/cicd-package/best-practice/.github/workflows/provision.yml +3 -1
  8. package/dist/practices/cicd-package/best-practice/.github/workflows/publish.yml +3 -0
  9. package/dist/practices/cicd-service/best-practice/.github/workflows/.deploy-sls.yml +21 -47
  10. package/dist/practices/cicd-service/best-practice/.github/workflows/.sql-schema-control.yml +19 -34
  11. package/dist/practices/cicd-service/best-practice/.github/workflows/.terraform.yml +22 -44
  12. package/dist/practices/cicd-service/best-practice/.github/workflows/deploy.yml +14 -24
  13. package/dist/practices/cicd-service/best-practice/.github/workflows/provision.yml +13 -26
  14. package/dist/practices/cicd-service/best-practice/package.json +1 -1
  15. package/dist/practices/provision-github/best-practice/package.json +1 -1
  16. package/dist/practices/provision-github/best-practice/provision/github/declastruct.resources.ts +2 -2
  17. package/package.json +4 -1
  18. package/dist/practices/cicd-service/best-practice/.github/workflows/test.yml +0 -23
@@ -15,19 +15,14 @@ on:
15
15
  type: string
16
16
  description: "the github environment that the apply step will be executed in"
17
17
  required: true
18
- aws-region:
18
+ creds-aws-region:
19
19
  type: string
20
- description: the aws region within which we should access
20
+ description: creds for aws, specifies the region
21
21
  required: true
22
- aws-account-id:
22
+ creds-aws-role-arn:
23
23
  type: string
24
- description: the id of the account the credentials are expected to access
24
+ description: creds for aws, specifies the role to assume via oidc
25
25
  required: true
26
- needs-vpn-for-acceptance:
27
- type: boolean
28
- description: whether or not this environment needs vpn access for acceptance tests
29
- required: false
30
- default: false
31
26
  app-web-deployment-s3-bucket:
32
27
  type: string
33
28
  description: the s3 bucket within which the web app is deployed
@@ -37,15 +32,10 @@ on:
37
32
  expo-token:
38
33
  required: true
39
34
  description: required credentials to authenticate with expo eas
40
- aws-access-key-id:
41
- required: true
42
- description: required credentials to authenticate with aws provider and state persistance
43
- aws-secret-access-key:
44
- required: true
45
- description: required credentials to authenticate with aws provider and state persistance
46
- open-vpn-config:
47
- required: false
48
- description: complete openvpn config required to enter the vpn, if needed
35
+
36
+ permissions:
37
+ id-token: write # required for oidc
38
+ contents: read
49
39
 
50
40
  jobs:
51
41
  deploy-os:
@@ -66,19 +56,11 @@ jobs:
66
56
  with:
67
57
  node-version-file: ".nvmrc"
68
58
 
69
- - name: configure aws credentials
70
- uses: aws-actions/configure-aws-credentials@v1
71
- id: credentials
59
+ - name: configure aws credentials (oidc)
60
+ uses: aws-actions/configure-aws-credentials@v4
72
61
  with:
73
- aws-access-key-id: ${{ secrets.aws-access-key-id }}
74
- aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
75
- aws-region: ${{ inputs.aws-region }}
76
-
77
- - name: confirm aws credentials
78
- run: |
79
- [[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
80
- && echo 'wrong aws account' && exit 1 \
81
- || echo 'correct aws account';
62
+ role-to-assume: ${{ inputs.creds-aws-role-arn }}
63
+ aws-region: ${{ inputs.creds-aws-region }}
82
64
 
83
65
  - name: node-modules cache get
84
66
  uses: actions/cache/restore@v4
@@ -116,19 +98,11 @@ jobs:
116
98
  with:
117
99
  node-version-file: ".nvmrc"
118
100
 
119
- - name: configure aws credentials
120
- uses: aws-actions/configure-aws-credentials@v1
121
- id: credentials
101
+ - name: configure aws credentials (oidc)
102
+ uses: aws-actions/configure-aws-credentials@v4
122
103
  with:
123
- aws-access-key-id: ${{ secrets.aws-access-key-id }}
124
- aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
125
- aws-region: ${{ inputs.aws-region }}
126
-
127
- - name: confirm aws credentials
128
- run: |
129
- [[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
130
- && echo 'wrong aws account' && exit 1 \
131
- || echo 'correct aws account';
104
+ role-to-assume: ${{ inputs.creds-aws-role-arn }}
105
+ aws-region: ${{ inputs.creds-aws-region }}
132
106
 
133
107
  - name: node-modules cache get
134
108
  uses: actions/cache/restore@v4
@@ -35,11 +35,8 @@ jobs:
35
35
  uses: ./.github/workflows/.test.yml
36
36
  if: github.event_name != 'workflow_dispatch' || github.event.inputs.thoroughly == 'true'
37
37
  with:
38
- aws-region: us-east-1
39
- aws-account-id: '@declapract{variable.awsAccountId.dev}'
40
- secrets:
41
- aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
42
- aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
38
+ creds-aws-region: us-east-1
39
+ creds-aws-role-arn: arn:aws:iam::@declapract{variable.awsAccountId.dev}:role/@declapract{variable.projectName}-github-actions-dev
43
40
 
44
41
  dev:
45
42
  uses: ./.github/workflows/.deploy-expo.yml
@@ -52,12 +49,10 @@ jobs:
52
49
  stage: dev
53
50
  build: development
54
51
  github-environment: dev
55
- aws-region: us-east-1
56
- aws-account-id: '@declapract{variable.awsAccountId.dev}'
52
+ creds-aws-region: us-east-1
53
+ creds-aws-role-arn: arn:aws:iam::@declapract{variable.awsAccountId.dev}:role/@declapract{variable.projectName}-github-actions-dev
57
54
  secrets:
58
55
  expo-token: ${{ secrets.EXPO_TOKEN }}
59
- aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
60
- aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
61
56
 
62
57
  prod:
63
58
  uses: ./.github/workflows/.deploy-expo.yml
@@ -69,10 +64,8 @@ jobs:
69
64
  stage: prod
70
65
  build: production
71
66
  github-environment: prod
72
- aws-region: us-east-1
73
- aws-account-id: '@declapract{variable.awsAccountId.prod}'
67
+ creds-aws-region: us-east-1
68
+ creds-aws-role-arn: arn:aws:iam::@declapract{variable.awsAccountId.prod}:role/@declapract{variable.projectName}-github-actions-prod
74
69
  app-web-deployment-s3-bucket: s3://@declapract{variable.projectName}-@declapract{variable.infrastructureNamespaceId}-prod
75
70
  secrets:
76
71
  expo-token: ${{ secrets.EXPO_TOKEN }}
77
- aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
78
- aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
@@ -13,10 +13,18 @@ on:
13
13
  type: boolean
14
14
  description: "whether the apply step is enabled. defaults to true on main"
15
15
  default: ${{ github.ref == 'refs/heads/main' }}
16
+ creds-github-app-owner:
17
+ type: string
18
+ required: false
19
+ description: "the owner of the github app to generate a token for"
20
+ creds-github-app-id:
21
+ type: string
22
+ required: false
23
+ description: "the id of the github app to generate a token for"
16
24
  secrets:
17
- github-token:
25
+ creds-github-app-private-key:
18
26
  required: false
19
- description: optional credentials to support authenticating with github provider
27
+ description: the private key of the github app to generate a token for
20
28
 
21
29
  jobs:
22
30
  # install the dependencies
@@ -43,13 +51,23 @@ jobs:
43
51
  path: ./node_modules
44
52
  key: ${{ needs.install.outputs.node-modules-cache-key }}
45
53
 
54
+ - name: get github auth, if creds supplied
55
+ if: ${{ inputs.creds-github-app-id }}
56
+ id: github-app-token
57
+ uses: actions/create-github-app-token@v2
58
+ with:
59
+ owner: ${{ inputs.creds-github-app-owner }}
60
+ repositories: ${{ github.event.repository.name }}
61
+ app-id: ${{ inputs.creds-github-app-id }}
62
+ private-key: ${{ secrets.creds-github-app-private-key }}
63
+
46
64
  - name: declastruct plan
47
65
  id: plan
48
66
  run: |
49
67
  set -o pipefail
50
68
  npx declastruct plan --wish ${{ inputs.wish-path }} --into ${{ inputs.wish-path }}.plan.json | tee ./plan.log
51
69
  env:
52
- GITHUB_TOKEN: ${{ secrets.github-token }} # allow specifying a github token to pass to the terraform command
70
+ GITHUB_TOKEN: ${{ steps.github-app-token.outputs.token }}
53
71
 
54
72
  - name: evaluate plan
55
73
  id: evaluate-plan
@@ -105,9 +123,19 @@ jobs:
105
123
  name: declastruct-plan
106
124
  path: ${{ steps.extract-dir.outputs.wish-dir }}
107
125
 
126
+ - name: get github auth, if creds supplied
127
+ if: ${{ inputs.creds-github-app-id }}
128
+ id: github-app-token
129
+ uses: actions/create-github-app-token@v2
130
+ with:
131
+ owner: ${{ inputs.creds-github-app-owner }}
132
+ repositories: ${{ github.event.repository.name }}
133
+ app-id: ${{ inputs.creds-github-app-id }}
134
+ private-key: ${{ secrets.creds-github-app-private-key }}
135
+
108
136
  - name: declastruct apply
109
137
  run: |
110
138
  set -o pipefail
111
139
  npx declastruct apply --plan ${{ inputs.wish-path }}.plan.json | tee ./apply.log
112
140
  env:
113
- GITHUB_TOKEN: ${{ secrets.github-token }} # allow specifying a github token to pass to the terraform command
141
+ GITHUB_TOKEN: ${{ steps.github-app-token.outputs.token }}
@@ -3,20 +3,19 @@ name: .test
3
3
  on:
4
4
  workflow_call:
5
5
  inputs:
6
- aws-region:
7
- type: string
8
- description: the aws region within which we should run the tests
9
- required: false
10
- secrets:
11
- aws-account-id:
12
- description: the id of the account the credentials are expected to access
6
+ creds-aws-role-arn:
7
+ description: "creds for aws, specifies the role to assume via oidc. if not provided, aws auth is skipped"
13
8
  required: false
14
- aws-access-key-id:
15
- required: false
16
- description: required credentials to authenticate with aws the aws account against which to run the tests
17
- aws-secret-access-key:
9
+ type: string
10
+ creds-aws-region:
11
+ description: "creds for aws, specifies the region. defaults to us-east-1"
18
12
  required: false
19
- description: required credentials to authenticate with aws the aws account against which to run the tests
13
+ type: string
14
+ default: "us-east-1"
15
+
16
+ permissions:
17
+ id-token: write # required for oidc
18
+ contents: read
20
19
 
21
20
  jobs:
22
21
  # install the dependencies
@@ -152,21 +151,12 @@ jobs:
152
151
  path: ./node_modules
153
152
  key: ${{ needs.install.outputs.node-modules-cache-key }}
154
153
 
155
- - name: configure aws credentials
156
- if: "${{ inputs.aws-region != '' }}"
157
- uses: aws-actions/configure-aws-credentials@v1
158
- id: credentials
154
+ - name: get aws auth, if creds supplied
155
+ if: ${{ inputs.creds-aws-role-arn }}
156
+ uses: aws-actions/configure-aws-credentials@v4
159
157
  with:
160
- aws-access-key-id: ${{ secrets.aws-access-key-id }}
161
- aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
162
- aws-region: ${{ inputs.aws-region }}
163
-
164
- - name: confirm aws credentials
165
- if: "${{ inputs.aws-region != '' }}"
166
- run: |
167
- [[ ${{steps.credentials.outputs.aws-account-id}} != ${{ secrets.aws-account-id }} ]] \
168
- && echo 'wrong aws account' && exit 1 \
169
- || echo 'correct aws account';
158
+ role-to-assume: ${{ inputs.creds-aws-role-arn }}
159
+ aws-region: ${{ inputs.creds-aws-region }}
170
160
 
171
161
  - name: start:testdb
172
162
  run: npm run start:testdb --if-present
@@ -195,21 +185,12 @@ jobs:
195
185
  path: ./node_modules
196
186
  key: ${{ needs.install.outputs.node-modules-cache-key }}
197
187
 
198
- - name: configure aws credentials
199
- if: "${{ inputs.aws-region != '' }}"
200
- uses: aws-actions/configure-aws-credentials@v1
201
- id: credentials
188
+ - name: get aws auth, if creds supplied
189
+ if: ${{ inputs.creds-aws-role-arn }}
190
+ uses: aws-actions/configure-aws-credentials@v4
202
191
  with:
203
- aws-access-key-id: ${{ secrets.aws-access-key-id }}
204
- aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
205
- aws-region: ${{ inputs.aws-region }}
206
-
207
- - name: confirm aws credentials
208
- if: "${{ inputs.aws-region != '' }}"
209
- run: |
210
- [[ ${{steps.credentials.outputs.aws-account-id}} != ${{ secrets.aws-account-id }} ]] \
211
- && echo 'wrong aws account' && exit 1 \
212
- || echo 'correct aws account';
192
+ role-to-assume: ${{ inputs.creds-aws-role-arn }}
193
+ aws-region: ${{ inputs.creds-aws-region }}
213
194
 
214
195
  - name: start:testdb
215
196
  run: npm run start:testdb --if-present
@@ -218,4 +199,4 @@ jobs:
218
199
  run: npm run start:livedb:dev --if-present
219
200
 
220
201
  - name: test:acceptance:locally
221
- run: npm run test:acceptance:locally
202
+ run: THOROUGH=true npm run test:acceptance --if-present
@@ -6,12 +6,55 @@ on:
6
6
  - main
7
7
 
8
8
  jobs:
9
- release-please:
9
+ please-release:
10
10
  runs-on: ubuntu-24.04
11
11
  steps:
12
- - uses: google-github-actions/release-please-action@v3.7.6 # https://github.com/googleapis/release-please-action/issues/840
12
+ - uses: actions/checkout@v4
13
13
  with:
14
- token: ${{ secrets.RELEASE_PLEASE_GITHUB_TOKEN }}
14
+ fetch-depth: 0 # need full history for tags
15
+
16
+ - name: check tags
17
+ id: check-tags
18
+ run: |
19
+ if git tag | grep -q .; then
20
+ echo "has-tags=true" >> $GITHUB_OUTPUT
21
+ else
22
+ echo "has-tags=false" >> $GITHUB_OUTPUT
23
+ echo "No tags found - will start at v0.1.0"
24
+ fi
25
+
26
+ - name: get github token
27
+ id: github-token
28
+ uses: actions/create-github-app-token@v2
29
+ with:
30
+ owner: ehmpathy
31
+ repositories: ${{ github.event.repository.name }}
32
+ app-id: ${{ vars.RHELEASE_APP_ID }}
33
+ private-key: ${{ secrets.RHELEASE_APP_PRIVATE_KEY }}
34
+
35
+ - name: upsert the tag or pr
36
+ id: release
37
+ uses: google-github-actions/release-please-action@v3.7.6 # https://github.com/googleapis/release-please-action/issues/840
38
+ with:
39
+ token: ${{ steps.github-token.outputs.token }}
15
40
  release-type: node
41
+ release-as: ${{ steps.check-tags.outputs.has-tags == 'false' && '0.1.0' || null }} # ensures new packages start at a sane choice of v0, instead of their default of v1
16
42
  pull-request-title-pattern: "chore(release): v${version} 🎉"
17
43
  changelog-path: changelog.md
44
+
45
+ - name: upvibe the pr, if pr
46
+ if: ${{ steps.release.outputs.pr }}
47
+ run: |
48
+ PR="${{ fromJson(steps.release.outputs.pr).number }}"
49
+
50
+ body="$(gh pr view "$PR" --json body -q .body)"
51
+
52
+ updated="$(printf "%s" "$body" \
53
+ | sed '1s/^:robot: I have created a release \*beep\* \*boop\*$/🐢 noice work! ready to let these changes ride?/' \
54
+ | sed 's/^### Features$/### features/' \
55
+ | sed 's/^### Bug Fixes$/### fixes/' \
56
+ )"
57
+
58
+ gh pr edit "$PR" --body "$updated"
59
+ env:
60
+ GH_TOKEN: ${{ steps.github-token.outputs.token }}
@@ -4,7 +4,7 @@ on:
4
4
  workflow_call:
5
5
  push:
6
6
  branches-ignore:
7
- - 'main' # exclude main branch, since deploy workflow triggers on main, and calls the test workflow inside of it already
7
+ - main # exclude main branch, since deploy workflow triggers on main, and calls the test workflow inside of it already
8
8
  tags-ignore:
9
9
  - v* # exclude tags, since deploy workflow triggers on tags, and calls the test workflow inside of it already
10
10
 
@@ -15,3 +15,6 @@ concurrency:
15
15
  jobs:
16
16
  suite:
17
17
  uses: ./.github/workflows/.test.yml
18
+ with:
19
+ creds-aws-region: us-east-1
20
+ creds-aws-role-arn: ${{ vars.CREDS_CICD_AWS_DEV_OIDC_ROLE_ARN }} # use aws auth via oidc, if this repo supplies it
@@ -20,5 +20,7 @@ jobs:
20
20
  with:
21
21
  wish-path: provision/github/declastruct.resources.ts
22
22
  github-environment: prod
23
+ creds-github-app-owner: ehmpathy
24
+ creds-github-app-id: ${{ vars.DECLASTRUCT_GITHUB_CONFORMER_APP_ID }}
23
25
  secrets:
24
- github-token: ${{ secrets.PROVISION_GITHUB_GITHUB_TOKEN }}
26
+ creds-github-app-private-key: ${{ secrets.DECLASTRUCT_GITHUB_CONFORMER_APP_PRIVATE_KEY }}
@@ -12,6 +12,9 @@ concurrency:
12
12
  jobs:
13
13
  test:
14
14
  uses: ./.github/workflows/.test.yml
15
+ with:
16
+ creds-aws-region: us-east-1
17
+ creds-aws-role-arn: ${{ vars.CREDS_CICD_AWS_DEV_OIDC_ROLE_ARN }} # use aws auth via oidc, if this repo supplies it
15
18
 
16
19
  publish:
17
20
  uses: ./.github/workflows/.publish-npm.yml
@@ -11,30 +11,28 @@ on:
11
11
  type: string
12
12
  description: "the github environment that the apply step will be executed in"
13
13
  required: true
14
- aws-region:
15
- type: string
16
- description: the aws region within which we should access
14
+ creds-aws-region:
15
+ description: "creds for aws, specifies the region"
17
16
  required: true
18
- aws-account-id:
19
17
  type: string
20
- description: the id of the account the credentials are expected to access
18
+ creds-aws-role-arn:
19
+ description: "creds for aws, specifies the role to assume via oidc"
21
20
  required: true
21
+ type: string
22
22
  needs-vpn-for-acceptance:
23
23
  type: boolean
24
24
  description: whether or not this environment needs vpn access for acceptance tests
25
25
  required: false
26
26
  default: false
27
27
  secrets:
28
- aws-access-key-id:
29
- required: true
30
- description: required credentials to authenticate with aws provider and state persistance
31
- aws-secret-access-key:
32
- required: true
33
- description: required credentials to authenticate with aws provider and state persistance
34
28
  pagerduty-integration-key:
35
29
  required: false
36
30
  description: enables sending pagerduty alarms on failure
37
31
 
32
+ permissions:
33
+ id-token: write # required for oidc
34
+ contents: read
35
+
38
36
  jobs:
39
37
  install:
40
38
  uses: ./.github/workflows/.install.yml
@@ -51,19 +49,11 @@ jobs:
51
49
  with:
52
50
  node-version-file: ".nvmrc"
53
51
 
54
- - name: configure aws credentials
55
- uses: aws-actions/configure-aws-credentials@v1
56
- id: credentials
52
+ - name: configure aws credentials (oidc)
53
+ uses: aws-actions/configure-aws-credentials@v4
57
54
  with:
58
- aws-access-key-id: ${{ secrets.aws-access-key-id }}
59
- aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
60
- aws-region: ${{ inputs.aws-region }}
61
-
62
- - name: confirm aws credentials
63
- run: |
64
- [[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
65
- && echo 'wrong aws account' && exit 1 \
66
- || echo 'correct aws account';
55
+ role-to-assume: ${{ inputs.creds-aws-role-arn }}
56
+ aws-region: ${{ inputs.creds-aws-region }}
67
57
 
68
58
  - name: node-modules cache get
69
59
  uses: actions/cache/restore@v4
@@ -87,19 +77,11 @@ jobs:
87
77
  with:
88
78
  node-version-file: ".nvmrc"
89
79
 
90
- - name: configure aws credentials
91
- uses: aws-actions/configure-aws-credentials@v1
92
- id: credentials
80
+ - name: configure aws credentials (oidc)
81
+ uses: aws-actions/configure-aws-credentials@v4
93
82
  with:
94
- aws-access-key-id: ${{ secrets.aws-access-key-id }}
95
- aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
96
- aws-region: ${{ inputs.aws-region }}
97
-
98
- - name: confirm aws credentials
99
- run: |
100
- [[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
101
- && echo 'wrong aws account' && exit 1 \
102
- || echo 'correct aws account';
83
+ role-to-assume: ${{ inputs.creds-aws-role-arn }}
84
+ aws-region: ${{ inputs.creds-aws-region }}
103
85
 
104
86
  - name: node-modules cache get
105
87
  uses: actions/cache/restore@v4
@@ -136,19 +118,11 @@ jobs:
136
118
  with:
137
119
  node-version-file: ".nvmrc"
138
120
 
139
- - name: configure aws credentials
140
- uses: aws-actions/configure-aws-credentials@v1
141
- id: credentials
121
+ - name: configure aws credentials (oidc)
122
+ uses: aws-actions/configure-aws-credentials@v4
142
123
  with:
143
- aws-access-key-id: ${{ secrets.aws-access-key-id }}
144
- aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
145
- aws-region: ${{ inputs.aws-region }}
146
-
147
- - name: confirm aws credentials
148
- run: |
149
- [[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
150
- && echo 'wrong aws account' && exit 1 \
151
- || echo 'correct aws account';
124
+ role-to-assume: ${{ inputs.creds-aws-role-arn }}
125
+ aws-region: ${{ inputs.creds-aws-region }}
152
126
 
153
127
  - name: node-modules cache get
154
128
  uses: actions/cache/restore@v4
@@ -14,19 +14,18 @@ on:
14
14
  type: boolean
15
15
  description: "whether the apply step is enabled. defaults to true on main"
16
16
  default: ${{ github.ref == 'refs/heads/main' }}
17
- aws-region:
17
+ creds-aws-region:
18
18
  type: string
19
- description: the aws region within which we should access
20
- aws-account-id:
21
- type: string
22
- description: the id of the account the credentials are expected to access
23
- secrets:
24
- aws-access-key-id:
19
+ description: creds for aws, specifies the region
25
20
  required: true
26
- description: required credentials to authenticate with aws provider for db credentials
27
- aws-secret-access-key:
21
+ creds-aws-role-arn:
22
+ type: string
23
+ description: creds for aws, specifies the role to assume via oidc
28
24
  required: true
29
- description: required credentials to authenticate with aws provider for db credentials
25
+
26
+ permissions:
27
+ id-token: write # required for oidc
28
+ contents: read
30
29
 
31
30
  jobs:
32
31
  install:
@@ -53,19 +52,12 @@ jobs:
53
52
  key: ${{ needs.install.outputs.node-modules-cache-key }}
54
53
  fail-on-cache-miss: true
55
54
 
56
- - name: configure aws credentials
57
- uses: aws-actions/configure-aws-credentials@v1
58
- id: credentials
55
+ - name: get aws auth
56
+ if: ${{ inputs.creds-aws-role-arn }}
57
+ uses: aws-actions/configure-aws-credentials@v4
59
58
  with:
60
- aws-access-key-id: ${{ secrets.aws-access-key-id }}
61
- aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
62
- aws-region: ${{ inputs.aws-region }}
63
-
64
- - name: confirm aws credentials
65
- run: |
66
- [[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
67
- && echo 'wrong aws account' && exit 1 \
68
- || echo 'correct aws account';
59
+ role-to-assume: ${{ inputs.creds-aws-role-arn }}
60
+ aws-region: ${{ inputs.creds-aws-region }}
69
61
 
70
62
  - name: vpc:tunnel:open
71
63
  run: STAGE=${{ inputs.stage }} .agent/repo=.this/skills/use.vpc.tunnel.ts
@@ -115,19 +107,12 @@ jobs:
115
107
  key: ${{ needs.install.outputs.node-modules-cache-key }}
116
108
  fail-on-cache-miss: true
117
109
 
118
- - name: configure aws credentials
119
- uses: aws-actions/configure-aws-credentials@v1
120
- id: credentials
110
+ - name: get aws auth
111
+ if: ${{ inputs.creds-aws-role-arn }}
112
+ uses: aws-actions/configure-aws-credentials@v4
121
113
  with:
122
- aws-access-key-id: ${{ secrets.aws-access-key-id }}
123
- aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
124
- aws-region: ${{ inputs.aws-region }}
125
-
126
- - name: confirm aws credentials
127
- run: |
128
- [[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
129
- && echo 'wrong aws account' && exit 1 \
130
- || echo 'correct aws account';
114
+ role-to-assume: ${{ inputs.creds-aws-role-arn }}
115
+ aws-region: ${{ inputs.creds-aws-region }}
131
116
 
132
117
  - name: vpc:tunnel:open
133
118
  run: STAGE=${{ inputs.stage }} .agent/repo=.this/skills/use.vpc.tunnel.ts
@@ -13,22 +13,18 @@ on:
13
13
  type: boolean
14
14
  description: "whether the apply step is enabled. defaults to true on main"
15
15
  default: ${{ github.ref == 'refs/heads/main' }}
16
- aws-region:
17
- type: string
18
- description: the aws region within which we should access
19
- aws-account-id:
20
- type: string
21
- description: the id of the account the credentials are expected to access
22
- secrets:
23
- aws-access-key-id:
16
+ creds-aws-region:
17
+ description: "creds for aws, specifies the region"
24
18
  required: true
25
- description: required credentials to authenticate with aws provider and state persistance
26
- aws-secret-access-key:
19
+ type: string
20
+ creds-aws-role-arn:
21
+ description: "creds for aws, specifies the role to assume via oidc"
27
22
  required: true
28
- description: required credentials to authenticate with aws provider and state persistance
29
- github-token:
30
- required: false
31
- description: optional credentials to support authenticating with github provider
23
+ type: string
24
+
25
+ permissions:
26
+ id-token: write # required for oidc
27
+ contents: read
32
28
 
33
29
  jobs:
34
30
  plan:
@@ -42,22 +38,15 @@ jobs:
42
38
  - name: checkout
43
39
  uses: actions/checkout@v4
44
40
 
45
- - name: configure aws credentials
46
- uses: aws-actions/configure-aws-credentials@v1
47
- id: credentials
41
+ - name: get aws auth
42
+ if: ${{ inputs.creds-aws-role-arn }}
43
+ uses: aws-actions/configure-aws-credentials@v4
48
44
  with:
49
- aws-access-key-id: ${{ secrets.aws-access-key-id }}
50
- aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
51
- aws-region: ${{ inputs.aws-region }}
52
-
53
- - name: confirm aws credentials
54
- run: |
55
- [[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
56
- && echo 'wrong aws account' && exit 1 \
57
- || echo 'correct aws account';
45
+ role-to-assume: ${{ inputs.creds-aws-role-arn }}
46
+ aws-region: ${{ inputs.creds-aws-region }}
58
47
 
59
48
  - name: setup terraform
60
- uses: hashicorp/setup-terraform@v2
49
+ uses: hashicorp/setup-terraform@v3
61
50
 
62
51
  - name: terraform init
63
52
  run: terraform init
@@ -68,8 +57,6 @@ jobs:
68
57
  - name: terraform plan
69
58
  id: plan
70
59
  run: terraform plan -detailed-exitcode | tee ./plan.log
71
- env:
72
- GITHUB_TOKEN: ${{ secrets.github-token }} # allow specifying a github token to pass to the terraform command
73
60
 
74
61
  - name: evaluate plan
75
62
  id: evaluate-plan
@@ -96,27 +83,18 @@ jobs:
96
83
  - name: checkout
97
84
  uses: actions/checkout@v4
98
85
 
99
- - name: configure aws credentials
100
- uses: aws-actions/configure-aws-credentials@v1
101
- id: credentials
86
+ - name: get aws auth
87
+ if: ${{ inputs.creds-aws-role-arn }}
88
+ uses: aws-actions/configure-aws-credentials@v4
102
89
  with:
103
- aws-access-key-id: ${{ secrets.aws-access-key-id }}
104
- aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
105
- aws-region: ${{ inputs.aws-region }}
106
-
107
- - name: confirm aws credentials
108
- run: |
109
- [[ ${{ steps.credentials.outputs.aws-account-id }} != ${{ inputs.aws-account-id }} ]] \
110
- && echo 'wrong aws account' && exit 1 \
111
- || echo 'correct aws account';
90
+ role-to-assume: ${{ inputs.creds-aws-role-arn }}
91
+ aws-region: ${{ inputs.creds-aws-region }}
112
92
 
113
93
  - name: setup terraform
114
- uses: hashicorp/setup-terraform@v2
94
+ uses: hashicorp/setup-terraform@v3
115
95
 
116
96
  - name: terraform init
117
97
  run: terraform init
118
98
 
119
99
  - name: terraform apply
120
100
  run: terraform apply -auto-approve
121
- env:
122
- GITHUB_TOKEN: ${{ secrets.github-token }} # allow specifying a github token to pass to the terraform command
@@ -5,26 +5,26 @@ on:
5
5
  tags:
6
6
  - v*
7
7
  branches:
8
- - 'main'
9
- - 'master'
8
+ - "main"
9
+ - "master"
10
10
  workflow_dispatch:
11
11
  inputs:
12
12
  stage:
13
- description: 'which stage do you want to deploy to?'
13
+ description: "which stage do you want to deploy to?"
14
14
  type: choice
15
15
  options:
16
16
  - dev
17
17
  - prod
18
18
  required: true
19
- default: 'dev'
19
+ default: "dev"
20
20
  thoroughly:
21
- description: 'should we run tests before this deployment?'
21
+ description: "should we run tests before this deployment?"
22
22
  type: choice
23
23
  required: true
24
- default: 'true'
24
+ default: "true"
25
25
  options:
26
- - 'true'
27
- - 'false'
26
+ - "true"
27
+ - "false"
28
28
 
29
29
  concurrency:
30
30
  group: ${{ github.workflow }}-${{ github.ref }} # per [workflow] x [branch, tag]
@@ -35,11 +35,8 @@ jobs:
35
35
  uses: ./.github/workflows/.test.yml
36
36
  if: github.event_name != 'workflow_dispatch' || github.event.inputs.thoroughly == 'true'
37
37
  with:
38
- aws-region: us-east-1
39
- secrets:
40
- aws-account-id: '@declapract{variable.awsAccountId.dev}'
41
- aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
42
- aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
38
+ creds-aws-region: us-east-1
39
+ creds-aws-role-arn: ${{ vars.CREDS_CICD_AWS_DEV_OIDC_ROLE_ARN }} # use aws auth via oidc, if this repo supplies it
43
40
 
44
41
  dev:
45
42
  uses: ./.github/workflows/.deploy-sls.yml
@@ -50,11 +47,8 @@ jobs:
50
47
  with:
51
48
  stage: dev
52
49
  github-environment: dev
53
- aws-region: us-east-1
54
- aws-account-id: '@declapract{variable.awsAccountId.dev}'
55
- secrets:
56
- aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
57
- aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
50
+ creds-aws-region: us-east-1
51
+ creds-aws-role-arn: ${{ vars.CREDS_CICD_AWS_DEV_OIDC_ROLE_ARN }}
58
52
 
59
53
  prod:
60
54
  uses: ./.github/workflows/.deploy-sls.yml
@@ -65,9 +59,5 @@ jobs:
65
59
  with:
66
60
  stage: prod
67
61
  github-environment: prod
68
- aws-region: us-east-1
69
- aws-account-id: '@declapract{variable.awsAccountId.prod}'
70
- secrets:
71
- aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
72
- aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
73
- pagerduty-integration-key: ${{ secrets.PAGERDUTY_INTEGRATION_KEY }}
62
+ creds-aws-region: us-east-1
63
+ creds-aws-role-arn: ${{ vars.CREDS_CICD_AWS_PROD_OIDC_ROLE_ARN }}
@@ -20,62 +20,49 @@ jobs:
20
20
  with:
21
21
  working-directory: provision/aws/environments/test
22
22
  github-environment: dev
23
- aws-region: us-east-1
24
- aws-account-id: "@declapract{variable.awsAccountId.dev}"
25
- secrets:
26
- aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
27
- aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
23
+ creds-aws-region: us-east-1
24
+ creds-aws-role-arn: ${{ vars.CREDS_CICD_AWS_DEV_OIDC_ROLE_ARN }}
28
25
 
29
26
  aws-dev:
30
27
  uses: ./.github/workflows/.terraform.yml
31
28
  with:
32
29
  working-directory: provision/aws/environments/dev
33
30
  github-environment: dev
34
- aws-region: us-east-1
35
- aws-account-id: "@declapract{variable.awsAccountId.dev}"
36
- secrets:
37
- aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
38
- aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
31
+ creds-aws-region: us-east-1
32
+ creds-aws-role-arn: ${{ vars.CREDS_CICD_AWS_DEV_OIDC_ROLE_ARN }}
39
33
 
40
34
  aws-prod:
41
35
  uses: ./.github/workflows/.terraform.yml
42
36
  with:
43
37
  working-directory: provision/aws/environments/prod
44
38
  github-environment: prod
45
- aws-region: us-east-1
46
- aws-account-id: "@declapract{variable.awsAccountId.prod}"
47
39
  allow-apply: ${{ startsWith(github.ref, 'refs/tags/') }} # only apply to prod on tags
48
- secrets:
49
- aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
50
- aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
40
+ creds-aws-region: us-east-1
41
+ creds-aws-role-arn: ${{ vars.CREDS_CICD_AWS_PROD_OIDC_ROLE_ARN }}
51
42
 
52
43
  github:
53
44
  uses: ./.github/workflows/.declastruct.yml
54
45
  with:
55
46
  wish-path: provision/github/declastruct.resources.ts
56
47
  github-environment: prod
48
+ creds-github-app-owner: ehmpathy
49
+ creds-github-app-id: ${{ vars.DECLASTRUCT_GITHUB_CONFORMER_APP_ID }}
57
50
  secrets:
58
- github-token: ${{ secrets.PROVISION_GITHUB_GITHUB_TOKEN }}
51
+ creds-github-app-private-key: ${{ secrets.DECLASTRUCT_GITHUB_CONFORMER_APP_PRIVATE_KEY }}
59
52
 
60
53
  sql-schema-dev:
61
54
  uses: ./.github/workflows/.sql-schema-control.yml
62
55
  with:
63
56
  stage: dev
64
57
  github-environment: dev
65
- aws-region: us-east-1
66
- aws-account-id: "@declapract{variable.awsAccountId.dev}"
67
- secrets:
68
- aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
69
- aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
58
+ creds-aws-region: us-east-1
59
+ creds-aws-role-arn: ${{ vars.CREDS_CICD_AWS_DEV_OIDC_ROLE_ARN }}
70
60
 
71
61
  sql-schema-prod:
72
62
  uses: ./.github/workflows/.sql-schema-control.yml
73
63
  with:
74
64
  stage: prod
75
65
  github-environment: prod
76
- aws-region: us-east-1
77
- aws-account-id: "@declapract{variable.awsAccountId.prod}"
78
66
  allow-apply: ${{ startsWith(github.ref, 'refs/tags/') }} # only apply to prod on tags
79
- secrets:
80
- aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
81
- aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
67
+ creds-aws-region: us-east-1
68
+ creds-aws-role-arn: ${{ vars.CREDS_CICD_AWS_PROD_OIDC_ROLE_ARN }}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "devDependencies": {
3
- "declastruct": "@declapract{check.minVersion('1.5.1')}",
3
+ "declastruct": "@declapract{check.minVersion('1.7.0')}",
4
4
  "declastruct-aws": "@declapract{check.minVersion('1.3.0')}",
5
5
  "declastruct-unix-network": "@declapract{check.minVersion('1.0.3')}"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "devDependencies": {
3
- "declastruct": "@declapract{check.minVersion('1.5.1')}",
3
+ "declastruct": "@declapract{check.minVersion('1.7.0')}",
4
4
  "declastruct-github": "@declapract{check.minVersion('1.0.7')}"
5
5
  }
6
6
  }
@@ -34,8 +34,8 @@ export const getProviders = async (): Promise<DeclastructProvider[]> => [
34
34
  export const getResources = async (): Promise<DomainEntity<any>[]> => {
35
35
  // declare the repo
36
36
  const repo = DeclaredGithubRepo.as({
37
- owner: 'ehmpathy',
38
- name: 'rhachet-roles-ehmpathy',
37
+ owner: '@declapract{variable.organizationName}',
38
+ name: '@declapract{variable.projectName}',
39
39
  description: (pkg as any).description ?? null,
40
40
  visibility: (pkg as any).private === true ? 'private' : 'public',
41
41
  private: (pkg as any).private ?? false, // todo: why do we have to specify this twice?
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "declapract-typescript-ehmpathy",
3
3
  "author": "ehmpathy",
4
4
  "description": "declapract best practices declarations for typescript",
5
- "version": "0.43.19",
5
+ "version": "0.44.1",
6
6
  "license": "MIT",
7
7
  "main": "src/index.js",
8
8
  "repository": "ehmpathy/declapract-typescript-ehmpathy",
@@ -17,6 +17,7 @@
17
17
  "fix:format:terraform": "terraform fmt -recursive",
18
18
  "fix:format": "npm run fix:format:prettier",
19
19
  "fix:lint": "eslint -c ./.eslintrc.js src/**/*.ts --fix",
20
+ "fix": "npm run fix:format && npm run fix:lint",
20
21
  "build:clean": "rm dist/ -rf",
21
22
  "build:compile": "npx declapract compile",
22
23
  "build": "npm run build:clean && npm run build:compile",
@@ -80,6 +81,8 @@
80
81
  "husky": "8.0.3",
81
82
  "jest": "29.3.1",
82
83
  "prettier": "2.8.1",
84
+ "rhachet": "1.13.1",
85
+ "rhachet-roles-ehmpathy": "1.13.8",
83
86
  "test-fns": "1.4.2",
84
87
  "ts-jest": "29.4.5",
85
88
  "tsx": "4.20.6",
@@ -1,23 +0,0 @@
1
- name: test
2
-
3
- on:
4
- workflow_call:
5
- push:
6
- branches-ignore:
7
- - 'main' # exclude main branch, since deploy workflow triggers on main, and calls the test workflow inside of it already
8
- tags-ignore:
9
- - v* # exclude tags, since deploy workflow triggers on tags, and calls the test workflow inside of it already
10
-
11
- concurrency:
12
- group: ${{ github.workflow }}-${{ github.ref }} # per [workflow] x [branch, tag]
13
- cancel-in-progress: true # cancel workflows for non-latest commits
14
-
15
- jobs:
16
- suite:
17
- uses: ./.github/workflows/.test.yml
18
- with:
19
- aws-region: us-east-1
20
- secrets:
21
- aws-account-id: '@declapract{variable.awsAccountId.dev}' # not a secret for services, but is a secret generically, since .test supports packages too
22
- aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
23
- aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}