name: EasyTier Nightly Release on: workflow_call: inputs: sha: description: Commit whose full builds the caller has waited for required: true type: string 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 env: BUILD_SHA: ${{ inputs.sha }} with: script: | const fs = require('node:fs'); const { prepare } = require('./.github/scripts/nightly-release.js'); const build = await prepare({ github, context, core, sha: process.env.BUILD_SHA }); 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 like version releases if: steps.prepare.outputs.ready == 'true' uses: actions/github-script@v8 with: script: | const fs = require('node:fs'); const { packageAssets } = require('./.github/scripts/nightly-release.js'); const build = require(`${process.env.GITHUB_WORKSPACE}/nightly-release.json`); await packageAssets({ build, source: 'nightly-artifacts', directory: 'nightly-assets' }); fs.writeFileSync('nightly-release.json', JSON.stringify(build)); - 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' });