|
| 1 | +name: Import verified standalone Playproof |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - .github/import-standalone-trigger |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: import-standalone-playproof |
| 15 | + cancel-in-progress: false |
| 16 | + |
| 17 | +jobs: |
| 18 | + import: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + timeout-minutes: 30 |
| 21 | + env: |
| 22 | + EXPECTED_ARCHIVE_SHA256: 263ab551051f84633d414bfb84509dc3de20d0e813756d48739672fb015d8b1c |
| 23 | + steps: |
| 24 | + - name: Check out public target |
| 25 | + uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + ref: main |
| 28 | + fetch-depth: 0 |
| 29 | + |
| 30 | + - name: Check out verified source carrier |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + repository: tangle-network/playproof |
| 34 | + ref: ops/install-verified-source |
| 35 | + path: .playproof-carrier |
| 36 | + fetch-depth: 1 |
| 37 | + persist-credentials: false |
| 38 | + |
| 39 | + - name: Reassemble and verify the exact source archive |
| 40 | + run: | |
| 41 | + set -euo pipefail |
| 42 | + mapfile -t chunks < <(find .playproof-carrier/.import -maxdepth 1 -type f -name 'full-*' -print | LC_ALL=C sort) |
| 43 | + test "${#chunks[@]}" -eq 35 |
| 44 | + cat "${chunks[@]}" | base64 --decode > "$RUNNER_TEMP/playproof-source.tar.gz" |
| 45 | + echo "$EXPECTED_ARCHIVE_SHA256 $RUNNER_TEMP/playproof-source.tar.gz" | sha256sum --check --strict |
| 46 | + tar -tzf "$RUNNER_TEMP/playproof-source.tar.gz" > "$RUNNER_TEMP/playproof-files.txt" |
| 47 | + grep -Eq '^(\./)?package\.json$' "$RUNNER_TEMP/playproof-files.txt" |
| 48 | + if grep -Eq '(^|/)(projects|\.evolve|\.git)(/|$)|(^|/)\.\./|^/' "$RUNNER_TEMP/playproof-files.txt"; then |
| 49 | + echo '::error::agent-lab material or unsafe path found in source archive' |
| 50 | + exit 1 |
| 51 | + fi |
| 52 | +
|
| 53 | + - name: Prepare the standalone release tree |
| 54 | + run: | |
| 55 | + set -euo pipefail |
| 56 | + RELEASE_DIR="$RUNNER_TEMP/playproof-release" |
| 57 | + rm -rf "$RELEASE_DIR" |
| 58 | + mkdir -p "$RELEASE_DIR" |
| 59 | + tar -xzf "$RUNNER_TEMP/playproof-source.tar.gz" -C "$RELEASE_DIR" |
| 60 | + rm -f "$RELEASE_DIR/.bootstrap-source-marker" "$RELEASE_DIR/.seed" |
| 61 | + find "$RELEASE_DIR/.github/workflows" -maxdepth 1 -type f -name '*bootstrap*.yml' -delete 2>/dev/null || true |
| 62 | + rm -f "$RELEASE_DIR/.github/workflows/import-standalone.yml" |
| 63 | + test "$(node -p "require('$RELEASE_DIR/package.json').name")" = '@tangle-network/playproof' |
| 64 | + test "$(node -p "require('$RELEASE_DIR/package.json').version")" = '0.1.0' |
| 65 | + test ! -e "$RELEASE_DIR/projects" |
| 66 | + test ! -e "$RELEASE_DIR/.evolve" |
| 67 | +
|
| 68 | + - uses: pnpm/action-setup@v4 |
| 69 | + with: |
| 70 | + version: 11.17.0 |
| 71 | + |
| 72 | + - uses: actions/setup-node@v4 |
| 73 | + with: |
| 74 | + node-version: 22 |
| 75 | + |
| 76 | + - uses: actions/setup-python@v5 |
| 77 | + with: |
| 78 | + python-version: '3.12' |
| 79 | + |
| 80 | + - name: Run complete public package gates |
| 81 | + run: | |
| 82 | + set -euo pipefail |
| 83 | + RELEASE_DIR="$RUNNER_TEMP/playproof-release" |
| 84 | + cd "$RELEASE_DIR" |
| 85 | + pnpm install --lockfile-only --no-frozen-lockfile |
| 86 | + pnpm install --frozen-lockfile |
| 87 | + python -m compileall -q desktop native pyboy |
| 88 | + pnpm run ci |
| 89 | +
|
| 90 | + - name: Replace seed tree and publish to main |
| 91 | + run: | |
| 92 | + set -euo pipefail |
| 93 | + RELEASE_DIR="$RUNNER_TEMP/playproof-release" |
| 94 | + find . -mindepth 1 -maxdepth 1 ! -name .git ! -name .playproof-carrier -exec rm -rf {} + |
| 95 | + cp -a "$RELEASE_DIR"/. . |
| 96 | + rm -rf .playproof-carrier |
| 97 | + test "$(node -p "require('./package.json').name")" = '@tangle-network/playproof' |
| 98 | + test -f pnpm-lock.yaml |
| 99 | + test ! -e projects |
| 100 | + test ! -e .evolve |
| 101 | + test ! -e .github/workflows/import-standalone.yml |
| 102 | + git config user.name github-actions[bot] |
| 103 | + git config user.email 41898282+github-actions[bot]@users.noreply.github.com |
| 104 | + git add --all |
| 105 | + git commit -m 'feat: import verified standalone Playproof framework' |
| 106 | + git push origin HEAD:main |
0 commit comments