Files
EasyTier/.github/workflows/nightly-release.yml
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

98 lines
3.7 KiB
YAML

name: EasyTier Nightly Release
on:
workflow_call:
workflow_run:
workflows: [EasyTier Core, EasyTier GUI, EasyTier Mobile, EasyTier Test]
branches: [main]
types: [completed]
workflow_dispatch:
concurrency:
group: easytier-nightly-release
cancel-in-progress: false
permissions:
actions: read
contents: write
jobs:
release:
if: >-
((github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') &&
github.ref == 'refs/heads/main') ||
(github.event.workflow_run.event == 'workflow_dispatch' &&
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_repository.full_name == github.repository)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
ref: main
- name: Select complete main builds and prepare release notes
id: prepare
uses: actions/github-script@v8
with:
script: |
const fs = require('node:fs');
const { prepare } = require('./.github/scripts/nightly-release.js');
const build = await prepare({ github, context, core });
if (!build) return;
fs.writeFileSync('nightly-release.json', JSON.stringify(build));
for (const workflow of ['core', 'gui', 'mobile']) {
core.setOutput(`${workflow}_run_id`, build.runs[workflow]);
core.setOutput(`${workflow}_artifact_ids`, build.artifacts[workflow].map(a => a.id).join(','));
// download-artifact extracts a single artifact directly into path.
const suffix = build.artifacts[workflow].length === 1 ? `/${build.artifacts[workflow][0].name}` : '';
core.setOutput(`${workflow}_path`, `nightly-artifacts${suffix}`);
}
core.setOutput('ready', 'true');
- name: Download Core artifacts
if: steps.prepare.outputs.ready == 'true'
uses: actions/download-artifact@v5
with:
github-token: ${{ github.token }}
run-id: ${{ steps.prepare.outputs.core_run_id }}
artifact-ids: ${{ steps.prepare.outputs.core_artifact_ids }}
path: ${{ steps.prepare.outputs.core_path }}
- name: Download GUI artifacts
if: steps.prepare.outputs.ready == 'true'
uses: actions/download-artifact@v5
with:
github-token: ${{ github.token }}
run-id: ${{ steps.prepare.outputs.gui_run_id }}
artifact-ids: ${{ steps.prepare.outputs.gui_artifact_ids }}
path: ${{ steps.prepare.outputs.gui_path }}
- name: Download Mobile artifacts
if: steps.prepare.outputs.ready == 'true'
uses: actions/download-artifact@v5
with:
github-token: ${{ github.token }}
run-id: ${{ steps.prepare.outputs.mobile_run_id }}
artifact-ids: ${{ steps.prepare.outputs.mobile_artifact_ids }}
path: ${{ steps.prepare.outputs.mobile_path }}
- name: Package assets with stable names
if: steps.prepare.outputs.ready == 'true'
shell: bash
run: |
mkdir nightly-assets
chmod -R 755 nightly-artifacts
for artifact in nightly-artifacts/*; do
name=$(basename "$artifact")
(cd "$artifact" && zip -qr "$GITHUB_WORKSPACE/nightly-assets/$name.zip" .)
done
- name: Update the fixed nightly prerelease
if: steps.prepare.outputs.ready == 'true'
uses: actions/github-script@v8
with:
script: |
const { publish } = require('./.github/scripts/nightly-release.js');
const build = require(`${process.env.GITHUB_WORKSPACE}/nightly-release.json`);
await publish({ github, context, core, build, directory: 'nightly-assets' });