Files
piik/.github/workflows/atomgit-mirror.yml
T
TNTcraft a6ddc01eca fix(release): decouple download mirrors from source synchronization
## Problem and outcome / 问题与结果

A published GitHub release could remain missing from AtomGit while the
mirror workflow reported a successful deferral, because it required the
mirrored Git commit and tag first. Package distribution now depends on
the canonical GitHub release and original artifacts. A missing mirror
proceeds to publication; only a matching stable release with its
complete attachment inventory counts as complete.

Release creation uses the mirror's default branch to satisfy AtomGit's
local tag requirement. The release body identifies GitHub as the source
authority, and the publisher retains full anonymous size/SHA-256
verification before marking the mirror stable. The operations guide
makes verified mirror publication part of release completion and
documents the read-only Pull-mirror restriction.

## Verification / 验证

- 58 release publication/readiness/source tests, tooling type checks and
repository hygiene passed.
- Workflow lint passed with the existing unsupported `concurrency.queue`
diagnostic excluded.
- Recovered the original v2.6.3 artifacts without rebuilding: all ten
packages (331,048,966 bytes) were uploaded, anonymously downloaded and
matched against their original SHA-256 values; AtomGit now reports
v2.6.3 as stable/latest.
- The platform's Pull association still needs to permit new local tags
independently of source synchronization; this remains an explicit
operator follow-up.

## Impact / 影响

Release tooling and its operating contract only; no App/Server version
or compatibility change. Scheduled retries remain recovery support and
no longer report missing source synchronization as successful
completion.
2026-11-13 15:23:00 -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 'Release mirror remains incomplete. Resume from original CI run %s; do not wait for source synchronization. If artifacts expired, recover retained original build output without rebuilding 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 }}