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
20 changes: 13 additions & 7 deletions actions/assemble-docs/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19056,6 +19056,7 @@ var require_dist = __commonJS({
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
var src_exports = {};
__export2(src_exports, {
absolutePath: () => absolutePath2,
deleteFile: () => deleteFile2,
exec: () => exec,
generateRandomSuffix: () => generateRandomSuffix,
Expand Down Expand Up @@ -19093,15 +19094,19 @@ var require_dist = __commonJS({
process.chdir(currentDir);
}
var import_node_fs = __toESM2(require("node:fs"));
var import_node_path2 = __toESM2(require("node:path"));
function moveFile(src, dest) {
import_node_fs.default.renameSync(src, dest);
}
function deleteFile2(path2) {
function deleteFile2(filePath) {
try {
import_node_fs.default.rmSync(path2);
import_node_fs.default.rmSync(filePath);
} catch {
}
}
function absolutePath2(p) {
return p.startsWith("/") ? p : import_node_path2.default.join(process.cwd(), p);
}
function gitAdd() {
exec(`git add .`);
}
Expand Down Expand Up @@ -19226,10 +19231,11 @@ async function run() {
const versionLabel = (0, import_action_utils2.getOptInput)("version_label", version2);
const versionInTitle = (0, import_action_utils2.getOptInput)("version_in_title", "");
const targetDir = (0, import_action_utils2.getInput)("target_dir");
const targetZipFile = import_node_path.default.join(process.cwd(), targetDir, `${version2}.zip`);
const absoluteAssetsDir = (0, import_action_utils2.absolutePath)(assetsDir);
const absoluteTargetDir = (0, import_action_utils2.absolutePath)(targetDir);
const targetZipFile = import_node_path.default.join(absoluteTargetDir, `${version2}.zip`);
const targetVersionsJsonFile = import_node_path.default.join(
process.cwd(),
targetDir,
absoluteTargetDir,
VERSIONS_JSON_FILE_NAME
);
if (!isValidVersion(version2)) {
Expand All @@ -19239,9 +19245,9 @@ async function run() {
}
core.info(`Cleaning up ${targetZipFile}`);
(0, import_action_utils2.deleteFile)(targetZipFile);
core.info(`Zipping ${assetsDir} to ${targetZipFile}`);
core.info(`Zipping ${absoluteAssetsDir} to ${targetZipFile}`);
(0, import_action_utils2.zip)({
absoluteSrcPath: assetsDir,
absoluteSrcPath: absoluteAssetsDir,
absoluteDestPath: targetZipFile
});
if (isVersionListedInVersionsJson(version2)) {
Expand Down
20 changes: 14 additions & 6 deletions actions/assemble-docs/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import path from 'node:path';
import * as core from '@actions/core';
import { deleteFile, getInput, getOptInput, zip } from '@dfinity/action-utils';
import {
absolutePath,
deleteFile,
getInput,
getOptInput,
zip,
} from '@dfinity/action-utils';
import { upsertVersionsJson } from './upsert-versions-json';
import {
ALLOWED_VERSIONS_MESSAGE,
Expand All @@ -17,10 +23,12 @@ export async function run(): Promise<void> {
const versionLabel = getOptInput('version_label', version);
const versionInTitle = getOptInput('version_in_title', '');
const targetDir = getInput('target_dir');
const targetZipFile = path.join(process.cwd(), targetDir, `${version}.zip`);

const absoluteAssetsDir = absolutePath(assetsDir);
const absoluteTargetDir = absolutePath(targetDir);
const targetZipFile = path.join(absoluteTargetDir, `${version}.zip`);
const targetVersionsJsonFile = path.join(
process.cwd(),
targetDir,
absoluteTargetDir,
VERSIONS_JSON_FILE_NAME,
);

Expand All @@ -33,9 +41,9 @@ export async function run(): Promise<void> {
core.info(`Cleaning up ${targetZipFile}`);
deleteFile(targetZipFile);

core.info(`Zipping ${assetsDir} to ${targetZipFile}`);
core.info(`Zipping ${absoluteAssetsDir} to ${targetZipFile}`);
zip({
absoluteSrcPath: assetsDir,
absoluteSrcPath: absoluteAssetsDir,
absoluteDestPath: targetZipFile,
});

Expand Down
9 changes: 7 additions & 2 deletions actions/create-pr/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23135,6 +23135,7 @@ var require_dist = __commonJS({
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
var src_exports = {};
__export2(src_exports, {
absolutePath: () => absolutePath,
deleteFile: () => deleteFile,
exec: () => exec,
generateRandomSuffix: () => generateRandomSuffix2,
Expand Down Expand Up @@ -23172,15 +23173,19 @@ var require_dist = __commonJS({
process.chdir(currentDir);
}
var import_node_fs = __toESM2(require("node:fs"));
var import_node_path = __toESM2(require("node:path"));
function moveFile(src, dest) {
import_node_fs.default.renameSync(src, dest);
}
function deleteFile(path) {
function deleteFile(filePath) {
try {
import_node_fs.default.rmSync(path);
import_node_fs.default.rmSync(filePath);
} catch {
}
}
function absolutePath(p) {
return p.startsWith("/") ? p : import_node_path.default.join(process.cwd(), p);
}
function gitAdd2() {
exec(`git add .`);
}
Expand Down
9 changes: 7 additions & 2 deletions actions/extract-version/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19056,6 +19056,7 @@ var require_dist = __commonJS({
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
var src_exports = {};
__export2(src_exports, {
absolutePath: () => absolutePath,
deleteFile: () => deleteFile,
exec: () => exec2,
generateRandomSuffix: () => generateRandomSuffix,
Expand Down Expand Up @@ -19093,15 +19094,19 @@ var require_dist = __commonJS({
process.chdir(currentDir);
}
var import_node_fs2 = __toESM2(require("node:fs"));
var import_node_path2 = __toESM2(require("node:path"));
function moveFile(src, dest) {
import_node_fs2.default.renameSync(src, dest);
}
function deleteFile(path2) {
function deleteFile(filePath) {
try {
import_node_fs2.default.rmSync(path2);
import_node_fs2.default.rmSync(filePath);
} catch {
}
}
function absolutePath(p) {
return p.startsWith("/") ? p : import_node_path2.default.join(process.cwd(), p);
}
function gitAdd() {
exec2(`git add .`);
}
Expand Down
9 changes: 7 additions & 2 deletions actions/submit-docs/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23135,6 +23135,7 @@ var require_dist = __commonJS({
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
var src_exports = {};
__export2(src_exports, {
absolutePath: () => absolutePath,
deleteFile: () => deleteFile,
exec: () => exec,
generateRandomSuffix: () => generateRandomSuffix,
Expand Down Expand Up @@ -23172,15 +23173,19 @@ var require_dist = __commonJS({
process.chdir(currentDir);
}
var import_node_fs = __toESM2(require("node:fs"));
var import_node_path = __toESM2(require("node:path"));
function moveFile(src, dest) {
import_node_fs.default.renameSync(src, dest);
}
function deleteFile(path) {
function deleteFile(filePath) {
try {
import_node_fs.default.rmSync(path);
import_node_fs.default.rmSync(filePath);
} catch {
}
}
function absolutePath(p) {
return p.startsWith("/") ? p : import_node_path.default.join(process.cwd(), p);
}
function gitAdd2() {
exec(`git add .`);
}
Expand Down
9 changes: 7 additions & 2 deletions lib/action-utils/src/fs.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import fs from 'node:fs';
import path from 'node:path';

export function moveFile(src: string, dest: string): void {
fs.renameSync(src, dest);
}

export function deleteFile(path: string): void {
export function deleteFile(filePath: string): void {
try {
fs.rmSync(path);
fs.rmSync(filePath);
} catch {
// ignore if file does not exist
}
}

export function absolutePath(p: string): string {
return p.startsWith('/') ? p : path.join(process.cwd(), p);
}