Skip to content

Commit

Permalink
fix(blueprint-builder): Clean up release.sh asset
Browse files Browse the repository at this point in the history
  • Loading branch information
aggagen committed Nov 17, 2023
1 parent 730c00b commit 158e211
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/blueprints/blueprint-builder/src/blueprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class Blueprint extends ParentBlueprint {

// copy-paste additional code over it
StaticAsset.findAll().forEach(asset => {
if (asset.path() === 'release.sh') {
if (asset.path() === 'release.sh' && !options.advancedSettings.releaseWorkflow) {
return;
}

Expand Down Expand Up @@ -242,7 +242,7 @@ export class Blueprint extends ParentBlueprint {
new Workflow(
this,
repository,
buildReleaseWorkflow(releaseWorkflow, repository, {
buildReleaseWorkflow(releaseWorkflow, {
includePublishStep: options.advancedSettings.includePublishingAction,
}).getDefinition(),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
import { SourceFile, SourceRepository, SubstitionAsset } from '@amazon-codecatalyst/blueprint-component.source-repositories';
import { TriggerType, WorkflowBuilder } from '@amazon-codecatalyst/blueprint-component.workflows';

export function buildReleaseWorkflow(
workflow: WorkflowBuilder,
repository: SourceRepository,
options?: { includePublishStep?: boolean },
): WorkflowBuilder {
export function buildReleaseWorkflow(workflow: WorkflowBuilder, options?: { includePublishStep?: boolean }): WorkflowBuilder {
const publishingEnabled = options?.includePublishStep ?? true;

workflow.setName('blueprint-release');
const RELEASE_COMMIT_PREFIX = 'chore(release):';
const BUILD_ARTIFACT_NAME = 'codebase';

const releaseScript = new SubstitionAsset('release.sh');
new SourceFile(repository, 'release.sh', releaseScript.substitute({ commitPrefix: RELEASE_COMMIT_PREFIX }));

workflow.addBranchTrigger(['main']);
workflow.addTrigger({
Type: TriggerType.MANUAL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ echo "Configuring git..."
git remote set-url origin $SOURCE_REPO_URL
git config --global user.email "noreply@amazon.com"
git config --global user.name "Release Workflow"
git add .
echo "Committing changes..."
RELEASE_COMMIT_MESSAGE="{{commitPrefix}} release $NEW_VERSION"
git add .
RELEASE_COMMIT_MESSAGE="chore(release): release $NEW_VERSION"
git commit -m "$RELEASE_COMMIT_MESSAGE"
echo "Pushing to origin..."
Expand Down

0 comments on commit 158e211

Please sign in to comment.