diff --git a/src/index.ts b/src/index.ts index a256882b..68d67baa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -337,6 +337,19 @@ export class CdktfProviderProject extends cdk.JsiiProject { setSafeDirectory ); + // ensure we don't fail if the release file is not present + // exit 0 if ./dist/dist/releasetag.txt is not present, otherwise exit 1 + const oldRun: string = (this.release as any).defaultBranch.workflow.jobs + .release.steps[5].run; + prettyAssertEqual( + oldRun.split("\n")[0], + "TAG=$(cat dist/dist/releasetag.txt)", + "release step changed, please check if the workaround still works!" + ); + ( + this.release as any + ).defaultBranch.workflow.jobs.release.steps[5].run = `if [ ! -f dist/dist/releasetag.txt ]; then (echo "exists=true" >> $GITHUB_OUTPUT) && exit 0; fi\n${oldRun}`; + if (!isDeprecated) { const { upgrade, pr } = (this.upgradeWorkflow as any).workflows[0].jobs; upgrade.steps.splice(1, 0, setSafeDirectory); diff --git a/test/__snapshots__/index.test.ts.snap b/test/__snapshots__/index.test.ts.snap index 2211e5d8..e4d9df3f 100644 --- a/test/__snapshots__/index.test.ts.snap +++ b/test/__snapshots__/index.test.ts.snap @@ -493,6 +493,7 @@ jobs: - name: Check if version has already been tagged id: check_tag_exists run: |- + if [ ! -f dist/dist/releasetag.txt ]; then (echo "exists=true" >> $GITHUB_OUTPUT) && exit 0; fi TAG=$(cat dist/dist/releasetag.txt) ([ ! -z "$TAG" ] && git ls-remote -q --exit-code --tags origin $TAG && (echo "exists=true" >> $GITHUB_OUTPUT)) || (echo "exists=false" >> $GITHUB_OUTPUT) cat $GITHUB_OUTPUT @@ -2790,6 +2791,7 @@ jobs: - name: Check if version has already been tagged id: check_tag_exists run: |- + if [ ! -f dist/dist/releasetag.txt ]; then (echo "exists=true" >> $GITHUB_OUTPUT) && exit 0; fi TAG=$(cat dist/dist/releasetag.txt) ([ ! -z "$TAG" ] && git ls-remote -q --exit-code --tags origin $TAG && (echo "exists=true" >> $GITHUB_OUTPUT)) || (echo "exists=false" >> $GITHUB_OUTPUT) cat $GITHUB_OUTPUT @@ -5539,6 +5541,7 @@ jobs: - name: Check if version has already been tagged id: check_tag_exists run: |- + if [ ! -f dist/dist/releasetag.txt ]; then (echo "exists=true" >> $GITHUB_OUTPUT) && exit 0; fi TAG=$(cat dist/dist/releasetag.txt) ([ ! -z "$TAG" ] && git ls-remote -q --exit-code --tags origin $TAG && (echo "exists=true" >> $GITHUB_OUTPUT)) || (echo "exists=false" >> $GITHUB_OUTPUT) cat $GITHUB_OUTPUT @@ -8273,6 +8276,7 @@ jobs: - name: Check if version has already been tagged id: check_tag_exists run: |- + if [ ! -f dist/dist/releasetag.txt ]; then (echo "exists=true" >> $GITHUB_OUTPUT) && exit 0; fi TAG=$(cat dist/dist/releasetag.txt) ([ ! -z "$TAG" ] && git ls-remote -q --exit-code --tags origin $TAG && (echo "exists=true" >> $GITHUB_OUTPUT)) || (echo "exists=false" >> $GITHUB_OUTPUT) cat $GITHUB_OUTPUT