Skip to content

Commit

Permalink
Deploying to releases/v1 from @ 5cf2591 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed May 12, 2022
1 parent 0bce4fe commit 3de7174
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 18 deletions.
19 changes: 13 additions & 6 deletions lib/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const utils_1 = require("./utils");
const once_1 = __importDefault(require("lodash/once"));
const io_1 = require("@actions/io");
const fs_extra_1 = __importDefault(require("fs-extra"));
const path_1 = __importDefault(require("path"));
const authorName = 'filestorage-action';
const authorEmail = 'filestorage-action@users.noreply.github.com';
const gitAuthor = `${authorName} <${authorEmail}>`;
Expand Down Expand Up @@ -52,11 +53,17 @@ function checkout(options) {
return constants_1.Status.SKIPPED;
}
yield generateWorktree(options, branchExists);
yield fs_extra_1.default.copy(`${options.workspace}/${temporaryStorageDirectory}/${options.path}`, `${options.workspace}/${options.path}`, {
overwrite: true,
recursive: true,
});
return constants_1.Status.SUCCESS;
try {
yield fs_extra_1.default.copy(path_1.default.resolve(options.workspace, temporaryStorageDirectory, `./${options.path}`), path_1.default.resolve(options.workspace, `./${options.path}`), {
overwrite: true,
recursive: true,
});
return constants_1.Status.SUCCESS;
}
catch (err) {
console.error(err);
return constants_1.Status.SKIPPED;
}
});
}
exports.checkout = checkout;
Expand All @@ -68,7 +75,7 @@ function save(options) {
yield init(options);
const branchExists = yield checkTargetBranchExist(options);
yield generateWorktree(options, branchExists);
yield fs_extra_1.default.copy(`${options.workspace}/${options.path}`, `${options.workspace}/${temporaryStorageDirectory}/${options.path}`, {
yield fs_extra_1.default.copy(path_1.default.resolve(options.workspace, `./${options.path}`), path_1.default.resolve(options.workspace, temporaryStorageDirectory, `./${options.path}`), {
overwrite: true,
recursive: true,
});
Expand Down
36 changes: 24 additions & 12 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,24 @@ export async function checkout(options: ActionInterface): Promise<Status> {

await generateWorktree(options, branchExists);

await fs.copy(
`${options.workspace}/${temporaryStorageDirectory}/${options.path}`,
`${options.workspace}/${options.path}`,
{
overwrite: true,
recursive: true,
}
);

return Status.SUCCESS;
try {
await fs.copy(
path.resolve(
options.workspace,
temporaryStorageDirectory,
`./${options.path}`
),
path.resolve(options.workspace, `./${options.path}`),
{
overwrite: true,
recursive: true,
}
);
return Status.SUCCESS;
} catch (err) {
console.error(err);
return Status.SKIPPED;
}
}

/**
Expand All @@ -79,8 +87,12 @@ export async function save(options: ActionInterface): Promise<Status> {
await generateWorktree(options, branchExists);

await fs.copy(
`${options.workspace}/${options.path}`,
`${options.workspace}/${temporaryStorageDirectory}/${options.path}`,
path.resolve(options.workspace, `./${options.path}`),
path.resolve(
options.workspace,
temporaryStorageDirectory,
`./${options.path}`
),
{
overwrite: true,
recursive: true,
Expand Down

0 comments on commit 3de7174

Please sign in to comment.