Skip to content

Commit

Permalink
fix: allow skip estuary publish test
Browse files Browse the repository at this point in the history
  • Loading branch information
diogomatsubara committed Jun 19, 2024
1 parent 8bc6ef7 commit c5cd230
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/release-crates-cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ on:
unpublished-deps-repos:
type: string
required: false
installation-test:
type: boolean
required: true
default: true
workflow_dispatch:
inputs:
repo:
Expand All @@ -35,6 +39,10 @@ on:
unpublished-deps-repos:
type: string
required: false
installation-test:
type: boolean
required: true
default: true

jobs:
publish:
Expand All @@ -49,3 +57,4 @@ jobs:
unpublished-deps-repos: ${{ inputs.unpublished-deps-repos }}
github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }}
crates-io-token: ${{ secrets.CRATES_IO_TOKEN }}
installation-test: ${{ inputs.installation-test }}
12 changes: 8 additions & 4 deletions dist/publish-crates-cargo-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -81358,6 +81358,7 @@ function setup() {
const cratesIoToken = _actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput("crates-io-token", { required: true });
const unpublishedDepsPatterns = _actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput("unpublished-deps-patterns");
const unpublishedDepsRepos = _actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput("unpublished-deps-repos");
const installationTest = _actions_core__WEBPACK_IMPORTED_MODULE_1__.getBooleanInput("installation-test", { required: true });
return {
liveRun,
branch,
Expand All @@ -81366,17 +81367,20 @@ function setup() {
unpublishedDepsRegExp: unpublishedDepsPatterns === "" ? /^$/ : new RegExp(unpublishedDepsPatterns.split("\n").join("|")),
unpublishedDepsRepos: unpublishedDepsRepos === "" ? [] : unpublishedDepsRepos.split("\n"),
cratesIoToken,
installationTest,
};
}
async function main(input) {
let registry = undefined;
try {
registry = await _estuary__WEBPACK_IMPORTED_MODULE_2__/* .spawn */ .C();
for (const repo of input.unpublishedDepsRepos) {
await publishToEstuary(input, repo, registry, input.unpublishedDepsRegExp);
if (input.installationTest) {
for (const repo of input.unpublishedDepsRepos) {
await publishToEstuary(input, repo, registry, input.unpublishedDepsRegExp);
}
await publishToEstuary(input, input.repo, registry, input.unpublishedDepsRegExp, input.branch);
await deleteRepos(input);
}
await publishToEstuary(input, input.repo, registry, input.unpublishedDepsRegExp, input.branch);
await deleteRepos(input);
if (input.liveRun) {
for (const repo of input.unpublishedDepsRepos) {
publishToCratesIo(input, repo);
Expand Down
2 changes: 2 additions & 0 deletions publish-crates-cargo/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ inputs:
required: false
unpublished-deps-repos:
required: false
installation-test:
required: true

runs:
using: node20
Expand Down
15 changes: 10 additions & 5 deletions src/publish-crates-cargo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type Input = {
unpublishedDepsRegExp: RegExp;
unpublishedDepsRepos: string[];
cratesIoToken?: string;
installationTest: boolean;
};

export function setup(): Input {
Expand All @@ -24,6 +25,7 @@ export function setup(): Input {
const cratesIoToken = core.getInput("crates-io-token", { required: true });
const unpublishedDepsPatterns = core.getInput("unpublished-deps-patterns");
const unpublishedDepsRepos = core.getInput("unpublished-deps-repos");
const installationTest = core.getBooleanInput("installation-test", { required: true });

return {
liveRun,
Expand All @@ -34,6 +36,7 @@ export function setup(): Input {
unpublishedDepsPatterns === "" ? /^$/ : new RegExp(unpublishedDepsPatterns.split("\n").join("|")),
unpublishedDepsRepos: unpublishedDepsRepos === "" ? [] : unpublishedDepsRepos.split("\n"),
cratesIoToken,
installationTest,
};
}

Expand All @@ -42,13 +45,15 @@ export async function main(input: Input) {
try {
registry = await estuary.spawn();

for (const repo of input.unpublishedDepsRepos) {
await publishToEstuary(input, repo, registry, input.unpublishedDepsRegExp);
}
if (input.installationTest) {
for (const repo of input.unpublishedDepsRepos) {
await publishToEstuary(input, repo, registry, input.unpublishedDepsRegExp);
}

await publishToEstuary(input, input.repo, registry, input.unpublishedDepsRegExp, input.branch);
await publishToEstuary(input, input.repo, registry, input.unpublishedDepsRegExp, input.branch);

await deleteRepos(input);
await deleteRepos(input);
}

if (input.liveRun) {
for (const repo of input.unpublishedDepsRepos) {
Expand Down

0 comments on commit c5cd230

Please sign in to comment.