|
| 1 | +# Assets-only GitHub release for fork bootstrap. |
| 2 | +# |
| 3 | +# This intentionally publishes GitHub Release binaries only. It does not |
| 4 | +# publish npm, PyPI, Chocolatey, Scoop, Homebrew, Winget, or MCP Registry |
| 5 | +# packages. Use release.yml when registry publishing credentials are available. |
| 6 | +name: Release Assets |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + version: |
| 12 | + description: "Release version (e.g. v0.8.1)" |
| 13 | + required: true |
| 14 | + type: string |
| 15 | + release_notes: |
| 16 | + description: "Release notes (optional; generated from commits if empty)" |
| 17 | + required: false |
| 18 | + type: string |
| 19 | + replace: |
| 20 | + description: "Replace existing release and tag if present" |
| 21 | + required: false |
| 22 | + type: boolean |
| 23 | + default: false |
| 24 | + draft: |
| 25 | + description: "Create as draft instead of publishing" |
| 26 | + required: false |
| 27 | + type: boolean |
| 28 | + default: false |
| 29 | + |
| 30 | +permissions: |
| 31 | + contents: read |
| 32 | + |
| 33 | +jobs: |
| 34 | + build: |
| 35 | + uses: ./.github/workflows/_build.yml |
| 36 | + with: |
| 37 | + version: ${{ inputs.version }} |
| 38 | + |
| 39 | + release-assets: |
| 40 | + needs: [build] |
| 41 | + if: ${{ !cancelled() && !failure() }} |
| 42 | + runs-on: ubuntu-latest |
| 43 | + permissions: |
| 44 | + contents: write |
| 45 | + id-token: write |
| 46 | + attestations: write |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
| 49 | + |
| 50 | + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 51 | + with: |
| 52 | + merge-multiple: true |
| 53 | + |
| 54 | + - name: List assets |
| 55 | + run: ls -la *.tar.gz *.zip |
| 56 | + |
| 57 | + - name: Generate checksums |
| 58 | + run: sha256sum *.tar.gz *.zip > checksums.txt |
| 59 | + |
| 60 | + - name: Generate SBOM |
| 61 | + env: |
| 62 | + VERSION: ${{ inputs.version }} |
| 63 | + run: | |
| 64 | + python3 - <<'PY' |
| 65 | + import json |
| 66 | + import os |
| 67 | + import time |
| 68 | +
|
| 69 | + version = os.environ["VERSION"] |
| 70 | + sbom = { |
| 71 | + "spdxVersion": "SPDX-2.3", |
| 72 | + "dataLicense": "CC0-1.0", |
| 73 | + "SPDXID": "SPDXRef-DOCUMENT", |
| 74 | + "name": f"code-intel-memory-{version}", |
| 75 | + "documentNamespace": f"https://github.com/heurema/code-intel-memory/releases/{version}", |
| 76 | + "creationInfo": { |
| 77 | + "created": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), |
| 78 | + "creators": ["Tool: code-intel-memory-assets-release"], |
| 79 | + }, |
| 80 | + "packages": [ |
| 81 | + {"SPDXID": "SPDXRef-Package-sqlite3", "name": "sqlite3", "versionInfo": "3.51.3", "licenseDeclared": "blessing", "downloadLocation": "https://sqlite.org", "filesAnalyzed": False}, |
| 82 | + {"SPDXID": "SPDXRef-Package-yyjson", "name": "yyjson", "versionInfo": "0.12.0", "licenseDeclared": "MIT", "downloadLocation": "https://github.com/ibireme/yyjson", "filesAnalyzed": False}, |
| 83 | + {"SPDXID": "SPDXRef-Package-mimalloc", "name": "mimalloc", "versionInfo": "3.3.2", "licenseDeclared": "MIT", "downloadLocation": "https://github.com/microsoft/mimalloc", "filesAnalyzed": False}, |
| 84 | + {"SPDXID": "SPDXRef-Package-xxhash", "name": "xxhash", "versionInfo": "0.8.3", "licenseDeclared": "BSD-2-Clause", "downloadLocation": "https://github.com/Cyan4973/xxHash", "filesAnalyzed": False}, |
| 85 | + {"SPDXID": "SPDXRef-Package-tre", "name": "tre", "versionInfo": "0.8.0", "licenseDeclared": "BSD-2-Clause", "downloadLocation": "https://github.com/laurikari/tre", "filesAnalyzed": False}, |
| 86 | + {"SPDXID": "SPDXRef-Package-tree-sitter", "name": "tree-sitter", "versionInfo": "0.24.4", "licenseDeclared": "MIT", "downloadLocation": "https://github.com/tree-sitter/tree-sitter", "filesAnalyzed": False}, |
| 87 | + {"SPDXID": "SPDXRef-Package-lz4", "name": "lz4", "versionInfo": "1.10.0", "licenseDeclared": "BSD-2-Clause", "downloadLocation": "https://github.com/lz4/lz4", "filesAnalyzed": False}, |
| 88 | + {"SPDXID": "SPDXRef-Package-zstd", "name": "zstd", "versionInfo": "1.5.7", "licenseDeclared": "BSD-3-Clause", "downloadLocation": "https://github.com/facebook/zstd", "filesAnalyzed": False}, |
| 89 | + {"SPDXID": "SPDXRef-Package-simplecpp", "name": "simplecpp", "versionInfo": "1.x", "licenseDeclared": "0BSD", "downloadLocation": "https://github.com/danmar/simplecpp", "filesAnalyzed": False}, |
| 90 | + {"SPDXID": "SPDXRef-Package-verstable", "name": "verstable", "versionInfo": "2.2.1", "licenseDeclared": "MIT", "downloadLocation": "https://github.com/JacksonAllan/Verstable", "filesAnalyzed": False}, |
| 91 | + {"SPDXID": "SPDXRef-Package-wyhash", "name": "wyhash", "versionInfo": "final-4.3", "licenseDeclared": "Unlicense", "downloadLocation": "https://github.com/wangyi-fudan/wyhash", "filesAnalyzed": False}, |
| 92 | + {"SPDXID": "SPDXRef-Package-nomic-embed-code", "name": "nomic-embed-code-token-embeddings", "versionInfo": "1.0", "licenseDeclared": "Apache-2.0", "downloadLocation": "https://huggingface.co/nomic-ai/nomic-embed-code", "filesAnalyzed": False, "comment": "Derived int8 token embeddings; see vendored/nomic/NOTICE"}, |
| 93 | + {"SPDXID": "SPDXRef-Package-tree-sitter-grammars", "name": "tree-sitter-grammars-aggregate", "versionInfo": "158-grammars", "licenseDeclared": "MIT", "downloadLocation": "NOASSERTION", "filesAnalyzed": False, "comment": "Aggregate of 158 vendored tree-sitter grammars. Predominantly MIT; exceptions: clojure CC0-1.0, jinja2 + just Apache-2.0, first-party grammars (c) DeusData MIT. Per-grammar provenance: internal/cbm/vendored/grammars/MANIFEST.md; full texts ship in THIRD_PARTY_NOTICES.md inside each archive."}, |
| 94 | + ], |
| 95 | + } |
| 96 | + with open("sbom.json", "w", encoding="utf-8") as f: |
| 97 | + json.dump(sbom, f, indent=2) |
| 98 | + PY |
| 99 | +
|
| 100 | + - name: Attest build provenance |
| 101 | + uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0 |
| 102 | + with: |
| 103 | + subject-path: '*.tar.gz,*.zip,checksums.txt' |
| 104 | + |
| 105 | + - name: Attest SBOM |
| 106 | + uses: actions/attest-sbom@c604332985a26aa8cf1bdc465b92731239ec6b9e # v4.1.0 |
| 107 | + with: |
| 108 | + subject-path: '*.tar.gz' |
| 109 | + sbom-path: 'sbom.json' |
| 110 | + |
| 111 | + - name: Install cosign |
| 112 | + uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2 |
| 113 | + |
| 114 | + - name: Sign assets |
| 115 | + run: | |
| 116 | + for f in *.tar.gz *.zip checksums.txt; do |
| 117 | + cosign sign-blob --yes --bundle "${f}.bundle" "$f" |
| 118 | + done |
| 119 | +
|
| 120 | + - name: Delete existing release |
| 121 | + if: ${{ inputs.replace }} |
| 122 | + env: |
| 123 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 124 | + VERSION: ${{ inputs.version }} |
| 125 | + run: gh release delete "$VERSION" --yes --cleanup-tag || true |
| 126 | + |
| 127 | + - name: Create release tag |
| 128 | + env: |
| 129 | + VERSION: ${{ inputs.version }} |
| 130 | + run: | |
| 131 | + git tag -f "$VERSION" "$GITHUB_SHA" |
| 132 | + git push origin "$VERSION" --force |
| 133 | +
|
| 134 | + - name: Publish GitHub release |
| 135 | + env: |
| 136 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 137 | + VERSION: ${{ inputs.version }} |
| 138 | + RELEASE_NOTES: ${{ inputs.release_notes }} |
| 139 | + DRAFT: ${{ inputs.draft }} |
| 140 | + run: | |
| 141 | + release_args=() |
| 142 | + if [ "$DRAFT" = "true" ]; then |
| 143 | + release_args+=(--draft) |
| 144 | + fi |
| 145 | +
|
| 146 | + if [ -n "$RELEASE_NOTES" ]; then |
| 147 | + printf '%s\n' "$RELEASE_NOTES" > release_notes.md |
| 148 | + release_args+=(--notes-file release_notes.md) |
| 149 | + else |
| 150 | + release_args+=(--generate-notes) |
| 151 | + fi |
| 152 | +
|
| 153 | + gh release create "$VERSION" \ |
| 154 | + --repo "$GITHUB_REPOSITORY" \ |
| 155 | + --target "$GITHUB_SHA" \ |
| 156 | + --title "$VERSION" \ |
| 157 | + "${release_args[@]}" \ |
| 158 | + *.tar.gz \ |
| 159 | + *.zip \ |
| 160 | + checksums.txt \ |
| 161 | + sbom.json \ |
| 162 | + *.bundle |
0 commit comments