|
| 1 | +name: Deploy Dev |
| 2 | + |
| 3 | +# Rolling continuous-deploy pipeline. Runs after `Basic Verification` succeeds |
| 4 | +# on `main` (smoke + acceptance tests must pass first). Builds linux x86_64 and |
| 5 | +# aarch64 musl for both `ocx` and `ocx-mirror` via cargo-zigbuild, then |
| 6 | +# publishes them to `dev.ocx.sh/ocx:<core>-dev_<timestamp>` (and |
| 7 | +# `mirror-<core>-dev_<timestamp>`). |
| 8 | +# |
| 9 | +# Musl-only matches the prod target set in `post-release-oci-publish.yml`. |
| 10 | +# Cross-compile uses cargo-zigbuild on ubuntu-22.04 (same toolchain choices as |
| 11 | +# cargo-dist's prod build path; full `dist build` alignment is deferred until |
| 12 | +# we can mirror the exact `dist plan` matrix). Published artifacts are tagged |
| 13 | +# as pre-release (`-dev_<TS>`) so they cannot collide with the stable graph. |
| 14 | + |
| 15 | +on: |
| 16 | + workflow_run: |
| 17 | + workflows: [Basic Verification] |
| 18 | + types: [completed] |
| 19 | + branches: [main] |
| 20 | + workflow_dispatch: |
| 21 | + |
| 22 | +permissions: |
| 23 | + contents: read |
| 24 | + |
| 25 | +# Serialize runs so the timestamp suffix stays monotonic; never cancel a |
| 26 | +# publish in flight. |
| 27 | +concurrency: |
| 28 | + group: deploy-dev-${{ github.ref }} |
| 29 | + cancel-in-progress: false |
| 30 | + |
| 31 | +jobs: |
| 32 | + compute-version: |
| 33 | + name: Compute version |
| 34 | + # workflow_run fires on every completion; gate on success. workflow_dispatch |
| 35 | + # bypasses the gate (manual trigger always proceeds). |
| 36 | + if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} |
| 37 | + runs-on: ubuntu-latest |
| 38 | + outputs: |
| 39 | + version: ${{ steps.cliff.outputs.version }} |
| 40 | + version_tag: ${{ steps.cliff.outputs.version_tag }} |
| 41 | + steps: |
| 42 | + - name: Checkout |
| 43 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 44 | + with: |
| 45 | + fetch-depth: 0 |
| 46 | + persist-credentials: false |
| 47 | + - name: Install git-cliff |
| 48 | + uses: taiki-e/install-action@58e862542551f667fa44c8a2a4a1d64ad477c96a # v2.75.17 |
| 49 | + with: |
| 50 | + tool: git-cliff |
| 51 | + - name: Compute next version and timestamp |
| 52 | + id: cliff |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + set -euo pipefail |
| 56 | + raw="$(git-cliff --bumped-version)" |
| 57 | + version="${raw#v}" |
| 58 | + if [[ -z "$version" ]]; then |
| 59 | + echo "::error::git-cliff --bumped-version returned empty output; no commits since last tag — refusing to publish a dev build" |
| 60 | + exit 1 |
| 61 | + fi |
| 62 | + ts="$(date -u +%Y%m%d%H%M%S)" |
| 63 | + echo "version=${version}" | tee -a "$GITHUB_OUTPUT" |
| 64 | + echo "version_tag=${version}-dev_${ts}" | tee -a "$GITHUB_OUTPUT" |
| 65 | +
|
| 66 | + build-linux: |
| 67 | + name: Build (${{ matrix.target }}) |
| 68 | + needs: [compute-version] |
| 69 | + # ubuntu-22.04 matches the runner cargo-dist plans for linux targets — |
| 70 | + # older glibc baseline for portability of any future gnu targets. |
| 71 | + runs-on: ubuntu-22.04 |
| 72 | + strategy: |
| 73 | + fail-fast: false |
| 74 | + matrix: |
| 75 | + target: |
| 76 | + - x86_64-unknown-linux-musl |
| 77 | + - aarch64-unknown-linux-musl |
| 78 | + steps: |
| 79 | + - name: Checkout |
| 80 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 81 | + with: |
| 82 | + submodules: true |
| 83 | + persist-credentials: false |
| 84 | + - name: Build |
| 85 | + uses: ./.github/actions/build-rust |
| 86 | + with: |
| 87 | + target: ${{ matrix.target }} |
| 88 | + # cargo-zigbuild covers aarch64 and musl targets uniformly from |
| 89 | + # x86_64 ubuntu runners; matches what cargo-dist uses for prod. |
| 90 | + use_zigbuild: true |
| 91 | + |
| 92 | + publish: |
| 93 | + name: Publish to dev.ocx.sh |
| 94 | + needs: [compute-version, build-linux] |
| 95 | + uses: ./.github/workflows/oci-publish.yml |
| 96 | + with: |
| 97 | + registry: dev.ocx.sh |
| 98 | + repo: ocx |
| 99 | + version_tag: ${{ needs.compute-version.outputs.version_tag }} |
| 100 | + variants: '["","mirror"]' |
| 101 | + targets: '["x86_64-unknown-linux-musl","aarch64-unknown-linux-musl"]' |
| 102 | + environment: dev.ocx.sh |
| 103 | + secrets: |
| 104 | + REGISTRY_USER: ${{ secrets.REGISTRY_USER }} |
| 105 | + REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} |
0 commit comments