Files
piik/.github/workflows/atomgit-mirror.yml
T
TNTcraft cf99f748a5 fix(release): resume pending mirrors from original artifacts
## Problem and outcome / 问题与结果

An otherwise published release could leave its AtomGit downloads incomplete when the platform had not yet synchronized its Git tag, or when a larger package exceeded the upload deadline. Recovery previously required a manual workflow run.

The existing mirror workflow now checks every three hours and after CI completion. It only resumes the latest published release, locates its original CI artifacts, and retains the existing full-download checksum verification. Complete or deferred mirrors use a sparse tooling checkout and skip dependency installation and artifact downloads. Git synchronization remains entirely with AtomGit; publication waits for the matching synchronized commit and tag and never creates or changes Git references.

Increase only the signed upload deadline from three to ten minutes, following the observed 51 MB APK timeout. Metadata/read timeouts, retry counts and the workflow's 30-minute limit remain unchanged.

## Verification / 验证

- 58 focused mirror/publisher tests, TypeScript, documentation and diff checks passed.
- Actual AtomGit readiness was checked against the v2.6.1 source and tag. Fixtures include the provider's four automatic source archives and distinguish them from uploaded packages.
- The release planner returns `publish: false`. This workflow resumes existing verified packages and performs no software build.

## Impact / 影响

Release automation only. Source synchronization belongs to AtomGit; Release and attachment completion belong to this workflow. Missing original artifacts or conflicting source identities remain explicit failures and never cause a published version to be rebuilt or overwritten.
2026-11-08 15:26:58 -04:00

98 lines
3.6 KiB
YAML

name: AtomGit mirror
on:
schedule:
- cron: '17 */3 * * *'
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
workflow_dispatch:
inputs:
run_id:
description: Original CI run (optional; otherwise find the current published source)
required: false
type: string
permissions:
contents: read
actions: read
concurrency:
group: atomgit-mirror
cancel-in-progress: false
queue: max
jobs:
mirror:
if: >-
github.repository == 'TNTcraftHIM/Piik' && github.ref == 'refs/heads/main' &&
(github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ||
(github.event.workflow_run.event == 'push' &&
github.event.workflow_run.head_branch == 'main'))
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
# Execute trusted main tooling; upstream artifacts are data, never code.
- uses: actions/checkout@v6
with:
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
/scripts/
/package.json
/package-lock.json
/.node-version
- uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: npm
- name: Check mirror readiness without build dependencies
id: readiness
run: node scripts/release-mirror-ready.mjs
env:
GH_TOKEN: ${{ github.token }}
- run: npm ci --ignore-scripts
if: steps.readiness.outputs.status == 'ready'
- name: Resolve the published source
id: source
if: steps.readiness.outputs.status == 'ready'
run: node scripts/release-mirror-source.mjs "$PIIK_SOURCE_RUN_ID"
env:
GH_TOKEN: ${{ github.token }}
PIIK_SOURCE_RUN_ID: ${{ inputs.run_id }}
- name: Download original Server artifacts
if: steps.source.outputs.mirror == 'true'
uses: actions/download-artifact@v8
with:
github-token: ${{ github.token }}
run-id: ${{ steps.source.outputs.run_id }}
pattern: piik-server*-${{ steps.source.outputs.revision }}
path: ${{ runner.temp }}/mirror-release
merge-multiple: true
- name: Download original App artifacts
if: steps.source.outputs.mirror == 'true'
uses: actions/download-artifact@v8
with:
github-token: ${{ github.token }}
run-id: ${{ steps.source.outputs.run_id }}
pattern: piik-app-*-${{ steps.source.outputs.revision }}
path: ${{ runner.temp }}/mirror-release
merge-multiple: true
- name: Mirror and verify original packages
if: steps.source.outputs.mirror == 'true'
run: >-
node scripts/mirror-release.mjs
"$RUNNER_TEMP/mirror-release" "$PIIK_RELEASE_VERSION" "$PIIK_RELEASE_REVISION"
env:
GH_TOKEN: ${{ github.token }}
ATOMGIT_TOKEN: ${{ secrets.ATOMGIT_TOKEN }}
PIIK_RELEASE_VERSION: ${{ steps.source.outputs.version }}
PIIK_RELEASE_REVISION: ${{ steps.source.outputs.revision }}
- name: Explain recovery
if: failure() && steps.source.outputs.mirror == 'true'
run: |
printf 'Mirror failed; the scheduled check will retry from original CI run %s. GitHub publication and Website are independent. If artifacts expired, recover the retained original build output; do not rebuild this version. See docs/operations/github.md.\n' "$PIIK_SOURCE_RUN_ID" >> "$GITHUB_STEP_SUMMARY"
env:
PIIK_SOURCE_RUN_ID: ${{ steps.source.outputs.run_id }}