Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
39 changes: 39 additions & 0 deletions .github/workflows/release.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { BundleCli } from './projenrc/bundle';
import { CodeCovWorkflow } from './projenrc/codecov';
import { ESLINT_RULES } from './projenrc/eslint';
import { JsiiBuild } from './projenrc/jsii';
import { RecordPublishingTimestamp } from './projenrc/record-publishing-timestamp';

// 5.7 sometimes gives a weird error in `ts-jest` in `@aws-cdk/cli-lib-alpha`
// https://github.com/microsoft/TypeScript/issues/60159
Expand Down Expand Up @@ -224,6 +225,9 @@ const repoProject = new yarn.Monorepo({
},
});

new AdcPublishing(repoProject);
new RecordPublishingTimestamp(repoProject);

// Eslint for projen config
// @ts-ignore
repoProject.eslint = new pj.javascript.Eslint(repoProject, {
Expand Down
1 change: 1 addition & 0 deletions projenrc/adc-publishing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class AdcPublishing extends Component {
'role-to-assume': '${{ vars.AWS_ROLE_TO_ASSUME_FOR_ACCOUNT }}',
'role-session-name': 'releasing@aws-cdk-cli',
'output-credentials': true,
'mask-aws-account-id': true,
},
},
{
Expand Down
68 changes: 68 additions & 0 deletions projenrc/record-publishing-timestamp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { Monorepo } from 'cdklabs-projen-project-types/lib/yarn';
import { Component } from 'projen';
import { JobPermission } from 'projen/lib/github/workflows-model';

/**
* Record publishing timestamp to SSM
*/
export class RecordPublishingTimestamp extends Component {
constructor(private readonly project_: Monorepo) {
super(project_);
}

public preSynthesize() {
const ssmPrefix = '/published/cdk/cli';

const releaseWf = this.project_.github?.tryFindWorkflow('release');
if (!releaseWf) {
throw new Error('Could not find release workflow');
}

releaseWf.addJob('record_timestamp', {
name: 'aws-cdk: Record publishing timestamp',
environment: 'releasing', // <-- this has the configuration
needs: ['release'],
runsOn: ['ubuntu-latest'],
permissions: {
contents: JobPermission.WRITE,
},
if: '${{ needs.release.outputs.latest_commit == github.sha }}',
steps: [
{
name: 'Download build artifacts',
uses: 'actions/download-artifact@v4',
with: {
name: 'aws-cdk_build-artifact',
path: 'dist',
},
},
{
name: 'Read version from build artifacts',
id: 'aws-cdk-version',
run: 'echo "version=$(cat dist/version.txt)" >> $GITHUB_OUTPUT',
},
{
name: 'Authenticate Via OIDC Role',
id: 'creds',
uses: 'aws-actions/configure-aws-credentials@v4',
with: {
'aws-region': 'us-east-1',
'role-duration-seconds': 14400,
'role-to-assume': '${{ vars.AWS_ROLE_TO_ASSUME_FOR_ACCOUNT }}',
'role-session-name': 'releasing@aws-cdk-cli',
'output-credentials': true,
'mask-aws-account-id': true,
},
},
{
name: 'Publish artifacts',
run: [
`aws ssm put-parameter --name "${ssmPrefix}/version" --type "String" --value "\${{ steps.aws-cdk-version.outputs.version }}" --overwrite`,
`aws ssm put-parameter --name "${ssmPrefix}/timestamp" --type "String" --value "$(date +%s)" --overwrite`,
].join('\n'),
},
],
});
}
}

Loading