mirror of
https://github.com/awalsh128/cache-apt-pkgs-action.git
synced 2026-11-14 05:46:50 +00:00
The integration jobs download an action-bundle-<sha> artifact that nothing built or uploaded, so all of them failed on their first step. v2 also had no bundle: action.yml runs dist/index.js, and an action has no node_modules at runtime. - Add rollup.config.mjs, which bundles the tsc output (dist/src) into a self-contained dist/index.js. npm run build now runs it. - Fix the setup action, which never built: with if_no_artifact_found: ignore the download step always succeeds, so check found_artifact. Download cached builds into dist/, and overwrite the build artifact since several jobs in a run can build it. - Upload action.yml and the bundle as action-bundle-<sha> from setup-and-cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
1.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
import commonjs from "@rollup/plugin-commonjs";
|
|
import json from "@rollup/plugin-json";
|
|
import { nodeResolve } from "@rollup/plugin-node-resolve";
|
|
|
|
/**
|
|
* Bundles the action and all of its dependencies into dist/index.js, the
|
|
* entrypoint action.yml runs. GitHub Actions doesn't install node_modules, so
|
|
* the bundle has to be self-contained.
|
|
*
|
|
* The input is the tsc output from `npm run build:lib`, so TypeScript is only
|
|
* compiled one way.
|
|
*
|
|
* @type {import('rollup').RollupOptions}
|
|
*/
|
|
export default {
|
|
input: "dist/src/index.js",
|
|
output: {
|
|
file: "dist/index.js",
|
|
format: "es",
|
|
sourcemap: true,
|
|
// Some CommonJS dependencies call require() at runtime.
|
|
banner:
|
|
"import { createRequire as __createRequire } from 'node:module';\n" +
|
|
"const require = __createRequire(import.meta.url);",
|
|
},
|
|
plugins: [
|
|
nodeResolve({ preferBuiltins: true, exportConditions: ["node"] }),
|
|
commonjs(),
|
|
json(),
|
|
],
|
|
onwarn(warning, warn) {
|
|
// Dependencies trigger these and they are harmless and very noisy:
|
|
// top level `this` in ES modules, misplaced /*@__PURE__*/ comments and
|
|
// circular imports inside third-party packages.
|
|
const fromDependency = (warning.ids ?? [warning.id ?? ""]).every((id) =>
|
|
id.includes("node_modules"),
|
|
);
|
|
if (
|
|
warning.code === "THIS_IS_UNDEFINED" ||
|
|
(fromDependency &&
|
|
["INVALID_ANNOTATION", "CIRCULAR_DEPENDENCY"].includes(warning.code))
|
|
) {
|
|
return;
|
|
}
|
|
warn(warning);
|
|
},
|
|
};
|