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
12 changes: 5 additions & 7 deletions dist/build-crates-debian-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128249,16 +128249,14 @@ function toDebianVersion(version, revision) {
return `${debVersion}`;
}
/**
* Check if Package is already published in crates.io
* Check if Package is already published
* @param pkg Package to check.
*/
function isPublished(pkg, env) {
const options = {
env,
};
// Hackish but crates.io doesn't have a stable api anyway.
function isPublished(pkg, options) {
options.check = false;
// Hackish but registries don't have a stable api anyway.
const results = sh(`cargo search ${pkg.name}`, options);
if (!results) {
if (!results || results.startsWith("error:")) {
return false;
}
const publishedVersion = results.split("\n").at(0).match(/".*"/g).at(0).slice(1, -1);
Expand Down
12 changes: 5 additions & 7 deletions dist/build-crates-standalone-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128233,16 +128233,14 @@ function toDebianVersion(version, revision) {
return `${debVersion}`;
}
/**
* Check if Package is already published in crates.io
* Check if Package is already published
* @param pkg Package to check.
*/
function isPublished(pkg, env) {
const options = {
env,
};
// Hackish but crates.io doesn't have a stable api anyway.
function isPublished(pkg, options) {
options.check = false;
// Hackish but registries don't have a stable api anyway.
const results = sh(`cargo search ${pkg.name}`, options);
if (!results) {
if (!results || results.startsWith("error:")) {
return false;
}
const publishedVersion = results.split("\n").at(0).match(/".*"/g).at(0).slice(1, -1);
Expand Down
12 changes: 5 additions & 7 deletions dist/bump-crates-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -81484,16 +81484,14 @@ function toDebianVersion(version, revision) {
return `${debVersion}`;
}
/**
* Check if Package is already published in crates.io
* Check if Package is already published
* @param pkg Package to check.
*/
function isPublished(pkg, env) {
const options = {
env,
};
// Hackish but crates.io doesn't have a stable api anyway.
function isPublished(pkg, options) {
options.check = false;
// Hackish but registries don't have a stable api anyway.
const results = sh(`cargo search ${pkg.name}`, options);
if (!results) {
if (!results || results.startsWith("error:")) {
return false;
}
const publishedVersion = results.split("\n").at(0).match(/".*"/g).at(0).slice(1, -1);
Expand Down
14 changes: 6 additions & 8 deletions dist/publish-crates-cargo-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -81369,16 +81369,14 @@ function toDebianVersion(version, revision) {
return `${debVersion}`;
}
/**
* Check if Package is already published in crates.io
* Check if Package is already published
* @param pkg Package to check.
*/
function isPublished(pkg, env) {
const options = {
env,
};
// Hackish but crates.io doesn't have a stable api anyway.
function isPublished(pkg, options) {
options.check = false;
// Hackish but registries don't have a stable api anyway.
const results = (0,_command__WEBPACK_IMPORTED_MODULE_5__.sh)(`cargo search ${pkg.name}`, options);
if (!results) {
if (!results || results.startsWith("error:")) {
return false;
}
const publishedVersion = results.split("\n").at(0).match(/".*"/g).at(0).slice(1, -1);
Expand Down Expand Up @@ -81712,7 +81710,7 @@ function publish(path, env, allowDirty = false) {
};
for (const package_ of _cargo__WEBPACK_IMPORTED_MODULE_3__/* .packagesOrdered */ .r4(path)) {
// Crates.io won't allow packages to be published with the same version
if (!_cargo__WEBPACK_IMPORTED_MODULE_3__/* .isPublished */ .s9(package_, env) && (package_.publish === undefined || package_.publish)) {
if (!_cargo__WEBPACK_IMPORTED_MODULE_3__/* .isPublished */ .s9(package_, options) && (package_.publish === undefined || package_.publish)) {
const command = ["cargo", "publish", "--manifest-path", package_.manifestPath];
if (allowDirty) {
command.push("--allow-dirty");
Expand Down
12 changes: 5 additions & 7 deletions dist/publish-crates-debian-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128228,16 +128228,14 @@ function toDebianVersion(version, revision) {
return `${debVersion}`;
}
/**
* Check if Package is already published in crates.io
* Check if Package is already published
* @param pkg Package to check.
*/
function isPublished(pkg, env) {
const options = {
env,
};
// Hackish but crates.io doesn't have a stable api anyway.
function isPublished(pkg, options) {
options.check = false;
// Hackish but registries don't have a stable api anyway.
const results = sh(`cargo search ${pkg.name}`, options);
if (!results) {
if (!results || results.startsWith("error:")) {
return false;
}
const publishedVersion = results.split("\n").at(0).match(/".*"/g).at(0).slice(1, -1);
Expand Down
12 changes: 5 additions & 7 deletions dist/publish-crates-eclipse-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128309,16 +128309,14 @@ function toDebianVersion(version, revision) {
return `${debVersion}`;
}
/**
* Check if Package is already published in crates.io
* Check if Package is already published
* @param pkg Package to check.
*/
function isPublished(pkg, env) {
const options = {
env,
};
// Hackish but crates.io doesn't have a stable api anyway.
function isPublished(pkg, options) {
options.check = false;
// Hackish but registries don't have a stable api anyway.
const results = sh(`cargo search ${pkg.name}`, options);
if (!results) {
if (!results || results.startsWith("error:")) {
return false;
}
const publishedVersion = results.split("\n").at(0).match(/".*"/g).at(0).slice(1, -1);
Expand Down
12 changes: 5 additions & 7 deletions dist/publish-crates-github-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128309,16 +128309,14 @@ function toDebianVersion(version, revision) {
return `${debVersion}`;
}
/**
* Check if Package is already published in crates.io
* Check if Package is already published
* @param pkg Package to check.
*/
function isPublished(pkg, env) {
const options = {
env,
};
// Hackish but crates.io doesn't have a stable api anyway.
function isPublished(pkg, options) {
options.check = false;
// Hackish but registries don't have a stable api anyway.
const results = sh(`cargo search ${pkg.name}`, options);
if (!results) {
if (!results || results.startsWith("error:")) {
return false;
}
const publishedVersion = results.split("\n").at(0).match(/".*"/g).at(0).slice(1, -1);
Expand Down
12 changes: 5 additions & 7 deletions dist/publish-crates-homebrew-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128213,16 +128213,14 @@ function toDebianVersion(version, revision) {
return `${debVersion}`;
}
/**
* Check if Package is already published in crates.io
* Check if Package is already published
* @param pkg Package to check.
*/
function isPublished(pkg, env) {
const options = {
env,
};
// Hackish but crates.io doesn't have a stable api anyway.
function isPublished(pkg, options) {
options.check = false;
// Hackish but registries don't have a stable api anyway.
const results = sh(`cargo search ${pkg.name}`, options);
if (!results) {
if (!results || results.startsWith("error:")) {
return false;
}
const publishedVersion = results.split("\n").at(0).match(/".*"/g).at(0).slice(1, -1);
Expand Down
14 changes: 6 additions & 8 deletions src/cargo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as core from "@actions/core";
import * as cache from "@actions/cache";

import { TOML } from "./toml";
import { sh } from "./command";
import { sh, CommandOptions } from "./command";
import { config } from "./config";
import * as cargo from "./cargo";

Expand Down Expand Up @@ -389,16 +389,14 @@ export function toDebianVersion(version: string, revision?: number): string {
}

/**
* Check if Package is already published in crates.io
* Check if Package is already published
* @param pkg Package to check.
*/
export function isPublished(pkg: Package, env: NodeJS.ProcessEnv): boolean {
const options = {
env,
};
// Hackish but crates.io doesn't have a stable api anyway.
export function isPublished(pkg: Package, options?: CommandOptions): boolean {
options.check = false;
// Hackish but registries don't have a stable api anyway.
const results = sh(`cargo search ${pkg.name}`, options);
if (!results) {
if (!results || results.startsWith("error:")) {
return false;
}
const publishedVersion = results.split("\n").at(0).match(/".*"/g).at(0).slice(1, -1);
Expand Down
2 changes: 1 addition & 1 deletion src/publish-crates-cargo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function publish(path: string, env: NodeJS.ProcessEnv, allowDirty: boolean = fal

for (const package_ of cargo.packagesOrdered(path)) {
// Crates.io won't allow packages to be published with the same version
if (!cargo.isPublished(package_, env) && (package_.publish === undefined || package_.publish)) {
if (!cargo.isPublished(package_, options) && (package_.publish === undefined || package_.publish)) {
const command = ["cargo", "publish", "--manifest-path", package_.manifestPath];
if (allowDirty) {
command.push("--allow-dirty");
Expand Down