|
| 1 | +# Release: on a version tag (e.g. v1.0.0), build the store-mysql plugin cdylib for all 5 |
| 2 | +# supported targets, pack + sign each into a loadable busbar plugin tarball, and publish them to |
| 3 | +# THIS repo's own GitHub Release. |
| 4 | +# |
| 5 | +# Same 5-target matrix, same busbar-plugin-pack pack/sign step (built from a sibling busbar |
| 6 | +# checkout), same BUSBAR_SIGN_KEY-or-`--allow-unsigned` fallback, same `gh release upload` + |
| 7 | +# build-provenance attestation pattern busbar's own plugins use — but every plugin (including this |
| 8 | +# one) now releases from its own repo; busbarAI no longer has a combined `store-plugins` release |
| 9 | +# job to mirror. |
| 10 | +# |
| 11 | +# This plugin's own version (the `v*` tag pushed here) is NOT tied to busbar's version number — |
| 12 | +# it is independently versioned starting at 0.5.0 (see README), separate from whichever busbar |
| 13 | +# commit it happens to build against via BUSBAR_REF below. |
| 14 | +name: release |
| 15 | + |
| 16 | +on: |
| 17 | + push: |
| 18 | + tags: |
| 19 | + - "v*" |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: write # create the Release + upload assets |
| 23 | + id-token: write # OIDC identity for keyless Sigstore signing (provenance) |
| 24 | + attestations: write # record the build-provenance attestation |
| 25 | + |
| 26 | +env: |
| 27 | + # Which busbar commit to check out as the sibling path dependency (used only to build |
| 28 | + # busbar-plugin-pack, which then packs + signs this plugin under BUSBAR_SIGN_KEY) — same |
| 29 | + # BUSBAR_REF convention ci.yml / plugin-ci.yml already established. Pinned to a commit SHA on |
| 30 | + # the 1.5.0-dev branch, not the branch name itself, since a mutable branch checked out while |
| 31 | + # holding the signing key is a supply-chain foot-gun. To bump deliberately: confirm the new SHA |
| 32 | + # builds busbar-plugin-pack cleanly, then update this value in a reviewed PR — never track the |
| 33 | + # branch automatically. Update to a `main` SHA once busbar 1.5.0 actually ships; until then the |
| 34 | + # plugin ABI surface this crate depends on only exists on 1.5.0-dev. |
| 35 | + BUSBAR_REF: 86d0b8397cc67bc8d27d5726d8f2766200728541 # dev, as of 2026-07-31 |
| 36 | + |
| 37 | +jobs: |
| 38 | + # Create the Release first so the parallel per-target upload jobs have something to attach to |
| 39 | + # (uploading from a matrix without a pre-existing release races -> "release not found"). |
| 40 | + create-release: |
| 41 | + runs-on: ubuntu-latest |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v7 |
| 44 | + - name: Create GitHub Release |
| 45 | + env: |
| 46 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 47 | + run: | |
| 48 | + set -euo pipefail |
| 49 | + if ! out=$(gh release create "${GITHUB_REF_NAME}" \ |
| 50 | + --repo "${GITHUB_REPOSITORY}" \ |
| 51 | + --title "busbar-store-mysql ${GITHUB_REF_NAME}" \ |
| 52 | + --verify-tag --generate-notes 2>&1); then |
| 53 | + if echo "$out" | grep -qi "already exists"; then |
| 54 | + echo "$out" |
| 55 | + echo "Release ${GITHUB_REF_NAME} already exists — reusing it (parallel matrix re-run or race)." |
| 56 | + gh release view "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" |
| 57 | + else |
| 58 | + echo "$out" >&2 |
| 59 | + exit 1 |
| 60 | + fi |
| 61 | + else |
| 62 | + echo "$out" |
| 63 | + fi |
| 64 | +
|
| 65 | + # One signed .tar.gz per target: {cdylib + manifest.json}, packed by busbar-plugin-pack and |
| 66 | + # signed with the busbar release PRIVATE key (BUSBAR_SIGN_KEY secret) so it verifies as |
| 67 | + # first-party against the PUBLIC key embedded in busbar's own release binaries. If that secret |
| 68 | + # isn't provisioned on this repo, falls back to an UNSIGNED tarball (loadable only under |
| 69 | + # plugins.trust.allow_unsigned) rather than blocking the release — same seam busbarAI's own |
| 70 | + # release.yml documents (TODO(release-keys)). |
| 71 | + store-plugin: |
| 72 | + needs: create-release |
| 73 | + name: store-plugin (${{ matrix.target }}) |
| 74 | + runs-on: ${{ matrix.os }} |
| 75 | + strategy: |
| 76 | + fail-fast: false |
| 77 | + matrix: |
| 78 | + include: |
| 79 | + - target: x86_64-unknown-linux-gnu |
| 80 | + os: ubuntu-latest |
| 81 | + libext: so |
| 82 | + libprefix: lib |
| 83 | + - target: aarch64-unknown-linux-gnu |
| 84 | + os: ubuntu-24.04-arm |
| 85 | + libext: so |
| 86 | + libprefix: lib |
| 87 | + - target: x86_64-apple-darwin |
| 88 | + os: macos-latest |
| 89 | + libext: dylib |
| 90 | + libprefix: lib |
| 91 | + - target: aarch64-apple-darwin |
| 92 | + os: macos-latest |
| 93 | + libext: dylib |
| 94 | + libprefix: lib |
| 95 | + - target: x86_64-pc-windows-msvc |
| 96 | + os: windows-latest |
| 97 | + libext: dll |
| 98 | + libprefix: "" |
| 99 | + steps: |
| 100 | + - name: Checkout store-mysql |
| 101 | + uses: actions/checkout@v7 |
| 102 | + with: |
| 103 | + path: store-mysql |
| 104 | + |
| 105 | + - name: Checkout busbar (sibling path dependency) |
| 106 | + uses: actions/checkout@v7 |
| 107 | + with: |
| 108 | + repository: GetBusbar/busbar |
| 109 | + ref: ${{ env.BUSBAR_REF }} |
| 110 | + path: busbarAI |
| 111 | + |
| 112 | + - uses: dtolnay/rust-toolchain@stable |
| 113 | + with: |
| 114 | + targets: ${{ matrix.target }} |
| 115 | + - uses: Swatinem/rust-cache@v2 |
| 116 | + |
| 117 | + - name: Build the store-mysql plugin cdylib |
| 118 | + working-directory: store-mysql |
| 119 | + run: cargo build --release --target ${{ matrix.target }} |
| 120 | + shell: bash |
| 121 | + |
| 122 | + - name: Build busbar-plugin-pack (from the sibling busbar checkout) |
| 123 | + working-directory: busbarAI |
| 124 | + run: cargo build --release --target ${{ matrix.target }} -p busbar-plugin-pack |
| 125 | + shell: bash |
| 126 | + |
| 127 | + - name: Package + sign the plugin tarball |
| 128 | + env: |
| 129 | + BUSBAR_SIGN_KEY: ${{ secrets.BUSBAR_SIGN_KEY }} |
| 130 | + run: | |
| 131 | + set -euo pipefail |
| 132 | + ver="${GITHUB_REF_NAME#v}" |
| 133 | + target="${{ matrix.target }}" |
| 134 | + outdir="plugin-dist"; mkdir -p "$outdir" |
| 135 | + pack="busbarAI/target/${target}/release/busbar-plugin-pack" |
| 136 | + [ -x "$pack" ] || pack="busbarAI/target/${target}/release/busbar-plugin-pack.exe" |
| 137 | + unsigned_flag="" |
| 138 | + if [ -z "${BUSBAR_SIGN_KEY:-}" ]; then |
| 139 | + echo "::warning::BUSBAR_SIGN_KEY secret is not provisioned — packaging an UNSIGNED plugin tarball (loadable only under plugins.trust.allow_unsigned). See busbarAI's release.yml TODO(release-keys) seam." |
| 140 | + unsigned_flag="--allow-unsigned" |
| 141 | + fi |
| 142 | + lib="store-mysql/target/${target}/release/${{ matrix.libprefix }}busbar_store_mysql_plugin.${{ matrix.libext }}" |
| 143 | + "$pack" pack \ |
| 144 | + --lib "$lib" \ |
| 145 | + --name "busbar-store-mysql-plugin" --alias "mysql" --kind store \ |
| 146 | + --version "$ver" --publisher busbar \ |
| 147 | + --description "First-party signed kind:store plugin cdylib: the MySQL/MariaDB backend for busbar's durable governance store, exported over the store C ABI. Drop the built library into the plugins folder and set store.module: mysql to share virtual keys, budgets, and usage across a fleet of busbar nodes." \ |
| 148 | + --license Apache-2.0 \ |
| 149 | + --out "${outdir}/busbar-store-mysql-${ver}-${target}.tar.gz" \ |
| 150 | + $unsigned_flag |
| 151 | + ls -l "$outdir" |
| 152 | + shell: bash |
| 153 | + |
| 154 | + - name: Attach plugin tarball to Release |
| 155 | + env: |
| 156 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 157 | + run: gh release upload "${GITHUB_REF_NAME}" plugin-dist/*.tar.gz --repo "${GITHUB_REPOSITORY}" --clobber |
| 158 | + shell: bash |
| 159 | + |
| 160 | + # Keyless (Sigstore/OIDC) build-provenance attestation binding this tarball's digest to this |
| 161 | + # workflow run + commit — `gh attestation verify <tarball> --repo ${{ github.repository }}`. |
| 162 | + - name: Attest plugin build provenance |
| 163 | + uses: actions/attest-build-provenance@v4 |
| 164 | + with: |
| 165 | + subject-path: "plugin-dist/*.tar.gz" |
0 commit comments