Spaces:
Running
Running
Delete .github/workflows/release.yaml
Browse files- .github/workflows/release.yaml +0 -155
.github/workflows/release.yaml
DELETED
|
@@ -1,155 +0,0 @@
|
|
| 1 |
-
name: Publish tagged container
|
| 2 |
-
|
| 3 |
-
on:
|
| 4 |
-
push:
|
| 5 |
-
tags: ["v*"]
|
| 6 |
-
|
| 7 |
-
permissions:
|
| 8 |
-
contents: read
|
| 9 |
-
checks: read
|
| 10 |
-
actions: read
|
| 11 |
-
packages: write
|
| 12 |
-
id-token: write
|
| 13 |
-
|
| 14 |
-
jobs:
|
| 15 |
-
validate-tag:
|
| 16 |
-
runs-on: ubuntu-latest
|
| 17 |
-
outputs:
|
| 18 |
-
version: ${{ steps.tag.outputs.version }}
|
| 19 |
-
steps:
|
| 20 |
-
- uses: actions/checkout@v4
|
| 21 |
-
with:
|
| 22 |
-
fetch-depth: 0
|
| 23 |
-
- id: tag
|
| 24 |
-
run: python scripts/release_version.py "$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT"
|
| 25 |
-
- name: Require tag version to match project metadata
|
| 26 |
-
run: |
|
| 27 |
-
project_version=$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml","rb"))["project"]["version"])')
|
| 28 |
-
expected_version="${{ steps.tag.outputs.project_version }}"
|
| 29 |
-
test "$project_version" = "$expected_version"
|
| 30 |
-
- name: Require the tagged commit to be on main
|
| 31 |
-
run: git merge-base --is-ancestor "$GITHUB_SHA" origin/main
|
| 32 |
-
|
| 33 |
-
verify-required-checks:
|
| 34 |
-
runs-on: ubuntu-latest
|
| 35 |
-
steps:
|
| 36 |
-
- uses: actions/checkout@v4
|
| 37 |
-
- name: Require successful quality and heavy validation for this commit
|
| 38 |
-
uses: actions/github-script@v7
|
| 39 |
-
with:
|
| 40 |
-
script: |
|
| 41 |
-
const required = [
|
| 42 |
-
"python",
|
| 43 |
-
"benchmark-helpers",
|
| 44 |
-
"frontend (console)",
|
| 45 |
-
"frontend (tui)",
|
| 46 |
-
"rust",
|
| 47 |
-
"image-light-smoke",
|
| 48 |
-
"heavy-smoke-and-restore",
|
| 49 |
-
];
|
| 50 |
-
const runs = await github.paginate(github.rest.checks.listForRef, {
|
| 51 |
-
owner: context.repo.owner,
|
| 52 |
-
repo: context.repo.repo,
|
| 53 |
-
ref: context.sha,
|
| 54 |
-
per_page: 100,
|
| 55 |
-
});
|
| 56 |
-
const failed = required.filter((name) =>
|
| 57 |
-
!runs.some((run) => run.name === name && run.conclusion === "success")
|
| 58 |
-
);
|
| 59 |
-
if (failed.length) {
|
| 60 |
-
core.setFailed(`Missing successful checks for ${context.sha}: ${failed.join(", ")}`);
|
| 61 |
-
}
|
| 62 |
-
- name: Download exact-commit validation artifacts
|
| 63 |
-
uses: actions/github-script@v7
|
| 64 |
-
with:
|
| 65 |
-
script: |
|
| 66 |
-
const fs = require("fs");
|
| 67 |
-
const required = [
|
| 68 |
-
["quality.yaml", "light-production-validation", "light.zip"],
|
| 69 |
-
["heavy-validation.yaml", "heavy-production-validation", "heavy.zip"],
|
| 70 |
-
];
|
| 71 |
-
for (const [workflow, artifactName, output] of required) {
|
| 72 |
-
const response = await github.rest.actions.listWorkflowRuns({
|
| 73 |
-
owner: context.repo.owner,
|
| 74 |
-
repo: context.repo.repo,
|
| 75 |
-
workflow_id: workflow,
|
| 76 |
-
head_sha: context.sha,
|
| 77 |
-
status: "completed",
|
| 78 |
-
per_page: 100,
|
| 79 |
-
});
|
| 80 |
-
const run = response.data.workflow_runs.find(
|
| 81 |
-
(item) => item.conclusion === "success"
|
| 82 |
-
);
|
| 83 |
-
if (!run) {
|
| 84 |
-
core.setFailed(`No successful ${workflow} run found for ${context.sha}`);
|
| 85 |
-
return;
|
| 86 |
-
}
|
| 87 |
-
const artifacts = await github.paginate(
|
| 88 |
-
github.rest.actions.listWorkflowRunArtifacts,
|
| 89 |
-
{
|
| 90 |
-
owner: context.repo.owner,
|
| 91 |
-
repo: context.repo.repo,
|
| 92 |
-
run_id: run.id,
|
| 93 |
-
per_page: 100,
|
| 94 |
-
}
|
| 95 |
-
);
|
| 96 |
-
const artifact = artifacts.find(
|
| 97 |
-
(item) => item.name === artifactName && !item.expired
|
| 98 |
-
);
|
| 99 |
-
if (!artifact) {
|
| 100 |
-
core.setFailed(`Missing ${artifactName} on workflow run ${run.id}`);
|
| 101 |
-
return;
|
| 102 |
-
}
|
| 103 |
-
const archive = await github.rest.actions.downloadArtifact({
|
| 104 |
-
owner: context.repo.owner,
|
| 105 |
-
repo: context.repo.repo,
|
| 106 |
-
artifact_id: artifact.id,
|
| 107 |
-
archive_format: "zip",
|
| 108 |
-
});
|
| 109 |
-
fs.writeFileSync(output, Buffer.from(archive.data));
|
| 110 |
-
}
|
| 111 |
-
- name: Enforce recorded product, restore, security, and benchmark gates
|
| 112 |
-
run: |
|
| 113 |
-
mkdir -p gate-input/light gate-input/heavy gate-artifacts
|
| 114 |
-
unzip -q light.zip -d gate-input/light
|
| 115 |
-
unzip -q heavy.zip -d gate-input/heavy
|
| 116 |
-
python scripts/assemble_release_artifacts.py --light gate-input/light --heavy gate-input/heavy --output gate-artifacts
|
| 117 |
-
python scripts/check_release_readiness.py gate-artifacts
|
| 118 |
-
- uses: actions/upload-artifact@v4
|
| 119 |
-
with:
|
| 120 |
-
name: release-evidence-${{ github.ref_name }}
|
| 121 |
-
path: gate-artifacts/
|
| 122 |
-
|
| 123 |
-
publish:
|
| 124 |
-
runs-on: ubuntu-latest
|
| 125 |
-
needs: [validate-tag, verify-required-checks]
|
| 126 |
-
steps:
|
| 127 |
-
- uses: actions/checkout@v4
|
| 128 |
-
- uses: actions/download-artifact@v4
|
| 129 |
-
with:
|
| 130 |
-
name: release-evidence-${{ github.ref_name }}
|
| 131 |
-
path: gate-artifacts
|
| 132 |
-
- name: Load and verify the gated image
|
| 133 |
-
run: |
|
| 134 |
-
gzip -dc gate-artifacts/brainapi-image.tar.gz | docker load
|
| 135 |
-
expected=$(python -c 'import json; print(json.load(open("gate-artifacts/security.json"))["image_digest"])')
|
| 136 |
-
actual=$(docker image inspect brainapi:ci --format '{{.Id}}')
|
| 137 |
-
test "$actual" = "$expected"
|
| 138 |
-
- uses: docker/login-action@v3
|
| 139 |
-
with:
|
| 140 |
-
registry: ghcr.io
|
| 141 |
-
username: ${{ github.actor }}
|
| 142 |
-
password: ${{ secrets.GITHUB_TOKEN }}
|
| 143 |
-
- id: publish
|
| 144 |
-
name: Publish the unchanged validated image
|
| 145 |
-
run: |
|
| 146 |
-
target="ghcr.io/lumen-labs/brainapi:$GITHUB_REF_NAME"
|
| 147 |
-
docker tag brainapi:ci "$target"
|
| 148 |
-
docker push "$target"
|
| 149 |
-
digest=$(docker image inspect "$target" --format '{{index .RepoDigests 0}}' | cut -d@ -f2)
|
| 150 |
-
test -n "$digest"
|
| 151 |
-
echo "$digest" > image-digest.txt
|
| 152 |
-
- uses: actions/upload-artifact@v4
|
| 153 |
-
with:
|
| 154 |
-
name: release-image-digest-${{ needs.validate-tag.outputs.version }}
|
| 155 |
-
path: image-digest.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|