Skip to content

Commit

Permalink
ci: set if a release is latest or not (#34189)
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego authored Dec 16, 2024
1 parent 47f24c2 commit 430b6a2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/release-action/src/publishRelease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import path from 'path';
import * as core from '@actions/core';
import { exec } from '@actions/exec';
import * as github from '@actions/github';
import semver from 'semver';

import { createNpmFile } from './createNpmFile';
import { fixWorkspaceVersionsBeforePublish } from './fixWorkspaceVersionsBeforePublish';
Expand Down Expand Up @@ -87,12 +88,19 @@ export async function publishRelease({

await pushChanges();

const { data: latestRelease } = await octokit.rest.repos.getLatestRelease({
...github.context.repo,
});

core.info(`latest release tag: ${latestRelease.tag_name}`);

core.info('create release');
await octokit.rest.repos.createRelease({
name: newVersion,
tag_name: newVersion,
body: releaseBody,
prerelease: newVersion.includes('-'),
make_latest: semver.gt(newVersion, latestRelease.tag_name) ? 'true' : 'false',
...github.context.repo,
});
}

0 comments on commit 430b6a2

Please sign in to comment.