Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow skip estuary publish test #180

Merged
merged 3 commits into from
Jun 19, 2024
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
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
publication-test:
type: boolean
required: true
default: false
workflow_dispatch:
inputs:
repo:
Expand All @@ -35,6 +39,10 @@ on:
unpublished-deps-repos:
type: string
required: false
publication-test:
type: boolean
required: true
default: false

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 }}
publication-test: ${{ inputs.publication-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 publicationTest = _actions_core__WEBPACK_IMPORTED_MODULE_1__.getBooleanInput("publication-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,
publicationTest,
};
}
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.publicationTest) {
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
publication-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;
publicationTest: 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 publicationTest = core.getBooleanInput("publication-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,
publicationTest,
};
}

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.publicationTest) {
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