Files
EasyTier/.github/scripts/nightly-build.js
T
KKRainbow 36b4ffcc74 ci: publish rolling nightly releases with build deduplication (#2692)
* ci: publish rolling main nightly builds and retry failed jobs

Keep one nightly prerelease with stable artifact filenames. Publish
only successful Core, GUI, Mobile and Test runs from the same main
commit, and prevent older runs from replacing a newer nightly.

Generate dated changes against the latest published version release,
including manual prereleases, in newest-first order. Link the fixed
nightly download page from both READMEs.

Retry failed full-build jobs once on main and develop, excluding
cancelled runs and attempts after the first.

Validated with 28 Node tests, actionlint, archive packaging checks,
and read-only selection of real GitHub builds and release notes.
2026-10-14 01:24:00 +08:00

33 lines
1.1 KiB
JavaScript

module.exports = async ({ github, context, core }) => {
const repository = context.repo;
const branches = await github.paginate(github.rest.repos.listBranches, {
...repository,
per_page: 100,
});
for (const branch of branches.filter(({ name }) => name === 'main')) {
for (const workflow of ['core.yml', 'gui.yml', 'mobile.yml', 'test.yml']) {
const { data } = await github.rest.actions.listWorkflowRuns({
...repository,
workflow_id: workflow,
branch: branch.name,
event: 'workflow_dispatch',
status: 'success',
per_page: 1,
});
if (data.workflow_runs[0]?.head_sha === branch.commit.sha) {
core.info(`${workflow}: ${branch.name} is already built successfully.`);
continue;
}
await github.rest.actions.createWorkflowDispatch({
...repository,
workflow_id: workflow,
ref: branch.name,
...(workflow === 'core.yml' ? { inputs: { sign_windows: false } } : {}),
});
core.info(`${workflow}: dispatched a full build for ${branch.name}.`);
}
}
};