Skip to content

Commit f4f7455

Browse files
author
Test User
committed
fix(ci): unblock v1.20.5 release assets and Docker registry auth
Use rustup run stable for cargo-deb on self-hosted runners, run create-release when sibling jobs fail via always(), tolerate missing debian artifacts, and pass Terraphim registry credentials into Docker builds via BuildKit secrets.
1 parent ee84868 commit f4f7455

3 files changed

Lines changed: 45 additions & 7 deletions

File tree

.github/workflows/docker-multiarch.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ on:
4040
OP_SERVICE_ACCOUNT_TOKEN:
4141
description: '1Password service account token'
4242
required: false
43+
CARGO_REGISTRIES_TERRAPHIM_TOKEN:
44+
description: 'Bearer token for the Terraphim Gitea cargo registry'
45+
required: false
4346

4447
env:
4548
REGISTRY: ghcr.io
@@ -197,6 +200,29 @@ jobs:
197200
org.opencontainers.image.vendor=Terraphim AI
198201
ubuntu.version=${{ matrix.ubuntu-version }}
199202
203+
- name: Prepare Terraphim cargo registry token for Docker build
204+
id: cargo-registry-token
205+
env:
206+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
207+
CARGO_REGISTRIES_TERRAPHIM_TOKEN: ${{ secrets.CARGO_REGISTRIES_TERRAPHIM_TOKEN }}
208+
run: |
209+
TOKEN=""
210+
if [ -n "${CARGO_REGISTRIES_TERRAPHIM_TOKEN}" ]; then
211+
TOKEN="${CARGO_REGISTRIES_TERRAPHIM_TOKEN}"
212+
elif [ -n "${OP_SERVICE_ACCOUNT_TOKEN}" ]; then
213+
GITEA_TOKEN="$(op read "op://TerraphimPlatform/gitea-test-token/credential" 2>/dev/null || true)"
214+
if [ -n "${GITEA_TOKEN}" ]; then
215+
TOKEN="Bearer ${GITEA_TOKEN}"
216+
fi
217+
fi
218+
if [ -z "${TOKEN}" ]; then
219+
echo "::error::Terraphim cargo registry token unavailable (set CARGO_REGISTRIES_TERRAPHIM_TOKEN or OP_SERVICE_ACCOUNT_TOKEN)"
220+
exit 1
221+
fi
222+
echo "::add-mask::${TOKEN}"
223+
printf '%s' "${TOKEN}" > "${RUNNER_TEMP}/cargo_registry_token"
224+
echo "token_file=${RUNNER_TEMP}/cargo_registry_token" >> "${GITHUB_OUTPUT}"
225+
200226
- name: Build and push to GHCR
201227
uses: docker/build-push-action@v7
202228
with:
@@ -209,6 +235,8 @@ jobs:
209235
build-args: |
210236
UBUNTU_VERSION=${{ matrix.ubuntu-version }}
211237
RUST_VERSION=1.92.0
238+
secret-files: |
239+
cargo_registry_token=${{ steps.cargo-registry-token.outputs.token_file }}
212240
no-cache: true
213241
cache-from: type=gha
214242
cache-to: type=gha,mode=max
@@ -229,6 +257,8 @@ jobs:
229257
build-args: |
230258
UBUNTU_VERSION=${{ matrix.ubuntu-version }}
231259
RUST_VERSION=1.92.0
260+
secret-files: |
261+
cargo_registry_token=${{ steps.cargo-registry-token.outputs.token_file }}
232262
no-cache: true
233263
cache-from: type=gha
234264
provenance: false

.github/workflows/release-comprehensive.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ jobs:
430430
if command -v cargo-deb &>/dev/null; then
431431
cargo-deb --version
432432
else
433-
cargo install cargo-deb --version 3.1.1
433+
# Self-hosted runners may alias `cargo` via rustup; use stable explicitly.
434+
rustup run stable cargo install cargo-deb --locked --version 3.1.1
434435
fi
435436
436437
- name: Cache dependencies
@@ -464,9 +465,8 @@ jobs:
464465
- name: Build Debian packages
465466
run: |
466467
# Clean terraphim_server to ensure fresh UI embedding
467-
cargo clean -p terraphim_server
468-
469-
cargo deb -p terraphim_server --output target/debian/
468+
rustup run stable cargo clean -p terraphim_server
469+
rustup run stable cargo deb -p terraphim_server --output target/debian/
470470
471471
- name: Upload Debian packages
472472
uses: actions/upload-artifact@v5
@@ -600,9 +600,13 @@ jobs:
600600
601601
create-release:
602602
name: Create GitHub release
603-
needs: [verify-versions, verify-release-assets, build-binaries]
603+
needs: [verify-versions, verify-release-assets, build-binaries, sign-and-notarize-macos]
604604
if: >-
605+
always() &&
606+
!cancelled() &&
605607
needs.verify-versions.result == 'success' &&
608+
needs.build-binaries.result == 'success' &&
609+
needs.sign-and-notarize-macos.result == 'success' &&
606610
needs.verify-release-assets.result == 'success'
607611
runs-on: ubuntu-latest
608612
permissions:
@@ -622,6 +626,7 @@ jobs:
622626
- name: Download Debian package artifacts
623627
uses: actions/download-artifact@v4
624628
id: download_debian
629+
continue-on-error: true
625630
with:
626631
name: debian-packages
627632
path: release-assets

docker/Dockerfile.multiarch

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ WORKDIR /code
116116

117117
# Copy the workspace pieces required to resolve local path dependencies.
118118
COPY Cargo.toml Cargo.lock ./
119+
COPY .cargo/config.toml .cargo/config.toml
119120
COPY crates ./crates
120121
COPY terraphim_server ./terraphim_server
121122
COPY terraphim_ai_nodejs ./terraphim_ai_nodejs
@@ -125,8 +126,10 @@ COPY terraphim_firecracker/Cargo.toml terraphim_firecracker/
125126
RUN rm -rf terraphim_server/dist && mkdir -p terraphim_server/dist
126127
COPY --from=frontend-builder /app/dist ./terraphim_server/dist
127128

128-
# Build the application
129-
RUN . /root/.profile && \
129+
# Build the application (Terraphim registry auth via BuildKit secret)
130+
RUN --mount=type=secret,id=cargo_registry_token \
131+
export CARGO_REGISTRIES_TERRAPHIM_TOKEN="$(cat /run/secrets/cargo_registry_token)" && \
132+
. /root/.profile && \
130133
RUST_TARGET=$(cat /tmp/rust-target) && \
131134
cargo build --release --target=$RUST_TARGET --package terraphim_server
132135

0 commit comments

Comments
 (0)