Skip to content

Commit 7ebf642

Browse files
committed
fix(ci): only flag release when nextRelease exists
1 parent 707d97f commit 7ebf642

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,29 @@ jobs:
6868
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6969
DRY_RUN: ${{ github.event.inputs.dryRun || 'false' }}
7070
run: |
71-
EXTRA_ARGS=""
71+
node - <<'NODE'
72+
import fs from 'node:fs';
7273
73-
if [ "$DRY_RUN" = "true" ]; then
74-
echo "Running in dry-run mode"
75-
EXTRA_ARGS="--dry-run"
76-
fi
77-
78-
npx semantic-release $EXTRA_ARGS
79-
EXIT_CODE=$?
74+
(async () => {
75+
try {
76+
const { default: semanticRelease } = await import('semantic-release');
77+
const result = await semanticRelease({
78+
dryRun: process.env.DRY_RUN === 'true',
79+
});
8080
81-
if [ "$DRY_RUN" != "true" ] && [ $EXIT_CODE -eq 0 ]; then
82-
echo "released=true" >> "$GITHUB_OUTPUT"
83-
else
84-
echo "released=false" >> "$GITHUB_OUTPUT"
85-
fi
81+
if (!result || process.env.DRY_RUN === 'true') {
82+
fs.appendFileSync(process.env.GITHUB_OUTPUT, 'released=false\n');
83+
process.exit(0);
84+
}
8685
87-
exit $EXIT_CODE
86+
fs.appendFileSync(process.env.GITHUB_OUTPUT, 'released=true\n');
87+
fs.appendFileSync(process.env.GITHUB_OUTPUT, `version=${result.nextRelease.version}\n`);
88+
} catch (error) {
89+
console.error(error);
90+
process.exit(1);
91+
}
92+
})();
93+
NODE
8894
8995
- name: Extract version
9096
id: extract-version

0 commit comments

Comments
 (0)