Skip to content

Commit

Permalink
debugging live testing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jspaaks committed Jan 30, 2024
1 parent a9bcc32 commit e72b77e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
21 changes: 11 additions & 10 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ const releasing_1 = require("./releasing/");
const releasing_2 = require("./releasing/");
const upserting_1 = require("./upserting/");
const assert_1 = __importDefault(require("assert"));
const zenodraft_1 = __importDefault(require("zenodraft"));
// import { default as zenodraft } from 'zenodraft'
const zenodraft = __importStar(require("zenodraft"));
const read_inputs = () => {
const concept_id = core.getInput('concept');
const compression = core.getInput('compression');
Expand Down Expand Up @@ -74,21 +75,21 @@ const main = () => __awaiter(void 0, void 0, void 0, function* () {
core.startGroup('payload');
const payload = yield releasing_1.get_payload(metadata);
core.endGroup();
core.debug(`zenodraft = ${zenodraft_1.default}`);
core.debug(`zenodraft = ${zenodraft}`);
// create the deposition as a new version in a new concept or
// as a new version in an existing concept:
core.startGroup(`creating deposition on ${sandbox === true ? 'Zenodo Sandbox' : 'Zenodo'}`);
let version_id;
if (concept_id === '') {
version_id = yield zenodraft_1.default.deposition_create_concept(token, sandbox, verbose);
version_id = yield zenodraft.deposition_create_concept(token, sandbox, verbose);
}
else {
version_id = yield zenodraft_1.default.deposition_create_version(token, sandbox, concept_id, verbose);
version_id = yield zenodraft.deposition_create_version(token, sandbox, concept_id, verbose);
}
core.endGroup();
if (upsert_doi === true) {
core.startGroup('upserting doi');
const prereserved_doi = yield zenodraft_1.default.deposition_show_prereserved(token, sandbox, version_id, verbose);
const prereserved_doi = yield zenodraft.deposition_show_prereserved(token, sandbox, version_id, verbose);
upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi);
core.endGroup();
}
Expand All @@ -100,31 +101,31 @@ const main = () => __awaiter(void 0, void 0, void 0, function* () {
if (compression === 'tar.gz') {
yield exec_1.exec('touch', [archive_name]);
yield exec_1.exec('tar', ['--exclude=.git', `--exclude=${archive_name}`, '-zcvf', archive_name, '.']);
yield zenodraft_1.default.file_add(token, sandbox, version_id, archive_name, verbose);
yield zenodraft.file_add(token, sandbox, version_id, archive_name, verbose);
}
else if (compression === 'zip') {
yield exec_1.exec('zip', ['-r', '-x', '/.git*', '-v', archive_name, '.']);
yield zenodraft_1.default.file_add(token, sandbox, version_id, archive_name, verbose);
yield zenodraft.file_add(token, sandbox, version_id, archive_name, verbose);
}
else {
throw new Error('Unknown compression method.');
}
}
else {
for (const filename of filenames.split(' ')) {
yield zenodraft_1.default.file_add(token, sandbox, version_id, filename, verbose);
yield zenodraft.file_add(token, sandbox, version_id, filename, verbose);
}
}
core.endGroup();
// update the metadata if the user has specified a filename that contains metadata
if (metadata !== '') {
core.startGroup('adding metadata');
yield zenodraft_1.default.metadata_update(token, sandbox, version_id, metadata, verbose);
yield zenodraft.metadata_update(token, sandbox, version_id, metadata, verbose);
core.endGroup();
}
if (publish === true) {
core.startGroup('publishing');
yield zenodraft_1.default.deposition_publish(token, sandbox, version_id, verbose);
yield zenodraft.deposition_publish(token, sandbox, version_id, verbose);
core.endGroup();
}
yield releasing_2.update_github_state(payload, upsert_doi, metadata);
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { get_payload } from './releasing/'
import { update_github_state } from './releasing/'
import { upsert_prereserved_doi } from './upserting/'
import assert from 'assert'
import { default as zenodraft } from 'zenodraft'
// import { default as zenodraft } from 'zenodraft'
import * as zenodraft from 'zenodraft'


const read_inputs = () => {
Expand Down

0 comments on commit e72b77e

Please sign in to comment.