|
| 1 | +name: Deploy Dev |
| 2 | + |
| 3 | +# Manual deploy pipeline. Run via `gh workflow run "Deploy Dev"` or the Actions |
| 4 | +# UI. Builds all production targets (linux musl + darwin + windows) for `ocx` |
| 5 | +# and `ocx-mirror`, then publishes them to `dev.ocx.sh/ocx:<core>-dev_<TS>` |
| 6 | +# (and `mirror-<core>-dev_<TS>`). |
| 7 | +# |
| 8 | +# Musl-only linux matches the prod target set in `post-release-oci-publish.yml`. |
| 9 | +# Cross-compile uses cargo-zigbuild on ubuntu-22.04 (linux), native build on |
| 10 | +# macos-latest (darwin), and `cargo xwin` in a container on ubuntu-latest |
| 11 | +# (windows). Published artifacts are tagged as pre-release (`-dev_<TS>`) so |
| 12 | +# they cannot collide with the stable release graph. |
| 13 | + |
| 14 | +on: |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +# Serialize runs so the timestamp suffix stays monotonic; never cancel a |
| 21 | +# publish in flight. |
| 22 | +concurrency: |
| 23 | + group: deploy-dev-${{ github.ref }} |
| 24 | + cancel-in-progress: false |
| 25 | + |
| 26 | +jobs: |
| 27 | + compute-version: |
| 28 | + name: Compute version |
| 29 | + runs-on: ubuntu-latest |
| 30 | + outputs: |
| 31 | + version: ${{ steps.cliff.outputs.version }} |
| 32 | + version_tag: ${{ steps.cliff.outputs.version_tag }} |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 36 | + with: |
| 37 | + fetch-depth: 0 |
| 38 | + persist-credentials: false |
| 39 | + - name: Install git-cliff |
| 40 | + uses: taiki-e/install-action@58e862542551f667fa44c8a2a4a1d64ad477c96a # v2.75.17 |
| 41 | + with: |
| 42 | + tool: git-cliff |
| 43 | + - name: Compute next version and timestamp |
| 44 | + id: cliff |
| 45 | + shell: bash |
| 46 | + run: | |
| 47 | + set -euo pipefail |
| 48 | + raw="$(git-cliff --bumped-version)" |
| 49 | + version="${raw#v}" |
| 50 | + if [[ -z "$version" ]]; then |
| 51 | + echo "::error::git-cliff --bumped-version returned empty output; no commits since last tag — refusing to publish a dev build" |
| 52 | + exit 1 |
| 53 | + fi |
| 54 | + ts="$(date -u +%Y%m%d%H%M%S)" |
| 55 | + echo "version=${version}" | tee -a "$GITHUB_OUTPUT" |
| 56 | + echo "version_tag=${version}-dev_${ts}" | tee -a "$GITHUB_OUTPUT" |
| 57 | +
|
| 58 | + build-linux: |
| 59 | + name: Build (${{ matrix.target }}) |
| 60 | + needs: [compute-version] |
| 61 | + # ubuntu-22.04 matches the runner cargo-dist plans for linux targets — |
| 62 | + # older glibc baseline for portability of any future gnu targets. |
| 63 | + runs-on: ubuntu-22.04 |
| 64 | + strategy: |
| 65 | + fail-fast: false |
| 66 | + matrix: |
| 67 | + target: |
| 68 | + - x86_64-unknown-linux-musl |
| 69 | + - aarch64-unknown-linux-musl |
| 70 | + steps: |
| 71 | + - name: Checkout |
| 72 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 73 | + with: |
| 74 | + submodules: true |
| 75 | + persist-credentials: false |
| 76 | + - name: Build |
| 77 | + uses: ./.github/actions/build-rust |
| 78 | + with: |
| 79 | + target: ${{ matrix.target }} |
| 80 | + # cargo-zigbuild covers aarch64 and musl targets uniformly from |
| 81 | + # x86_64 ubuntu runners; matches what cargo-dist uses for prod. |
| 82 | + use_zigbuild: true |
| 83 | + |
| 84 | + build-darwin: |
| 85 | + name: Build (${{ matrix.target }}) |
| 86 | + needs: [compute-version] |
| 87 | + runs-on: macos-latest |
| 88 | + strategy: |
| 89 | + fail-fast: false |
| 90 | + matrix: |
| 91 | + target: |
| 92 | + - x86_64-apple-darwin |
| 93 | + - aarch64-apple-darwin |
| 94 | + steps: |
| 95 | + - name: Checkout |
| 96 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 97 | + with: |
| 98 | + submodules: true |
| 99 | + persist-credentials: false |
| 100 | + - name: Build |
| 101 | + uses: ./.github/actions/build-rust |
| 102 | + with: |
| 103 | + target: ${{ matrix.target }} |
| 104 | + |
| 105 | + build-windows: |
| 106 | + name: Build (${{ matrix.target }}) |
| 107 | + needs: [compute-version] |
| 108 | + runs-on: ubuntu-latest |
| 109 | + container: |
| 110 | + # messense/cargo-xwin has no stable versioned tag — pinned by digest. Re-pin with: |
| 111 | + # docker pull messense/cargo-xwin && docker inspect --format='{{index .RepoDigests 0}}' messense/cargo-xwin |
| 112 | + image: messense/cargo-xwin@sha256:543cdaeb5cd3ed0ca1dd29b9e5aba4100aa0008f8ed088b793f3b9255a635869 |
| 113 | + strategy: |
| 114 | + fail-fast: false |
| 115 | + matrix: |
| 116 | + target: |
| 117 | + - x86_64-pc-windows-msvc |
| 118 | + - aarch64-pc-windows-msvc |
| 119 | + steps: |
| 120 | + - name: Checkout |
| 121 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 122 | + with: |
| 123 | + submodules: true |
| 124 | + persist-credentials: false |
| 125 | + - name: Install Rust target |
| 126 | + shell: bash |
| 127 | + run: rustup target add ${{ matrix.target }} |
| 128 | + - name: Build |
| 129 | + shell: bash |
| 130 | + run: cargo xwin build --release --target=${{ matrix.target }} --locked |
| 131 | + - name: Prepare Binaries |
| 132 | + shell: bash |
| 133 | + run: | |
| 134 | + cp target/${{ matrix.target }}/release/ocx.exe ocx-${{ matrix.target }}.exe |
| 135 | + cp target/${{ matrix.target }}/release/ocx-mirror.exe ocx-mirror-${{ matrix.target }}.exe |
| 136 | + - name: Upload ocx Binary |
| 137 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 138 | + with: |
| 139 | + name: ocx-${{ matrix.target }} |
| 140 | + path: ocx-${{ matrix.target }}.exe |
| 141 | + compression-level: 0 |
| 142 | + retention-days: 1 |
| 143 | + - name: Upload ocx-mirror Binary |
| 144 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 145 | + with: |
| 146 | + name: ocx-mirror-${{ matrix.target }} |
| 147 | + path: ocx-mirror-${{ matrix.target }}.exe |
| 148 | + compression-level: 0 |
| 149 | + retention-days: 1 |
| 150 | + |
| 151 | + publish: |
| 152 | + name: Publish to dev.ocx.sh |
| 153 | + needs: [compute-version, build-linux, build-darwin, build-windows] |
| 154 | + uses: ./.github/workflows/oci-publish.yml |
| 155 | + with: |
| 156 | + registry: dev.ocx.sh |
| 157 | + repo: ocx |
| 158 | + version_tag: ${{ needs.compute-version.outputs.version_tag }} |
| 159 | + variants: '["","mirror"]' |
| 160 | + targets: '["x86_64-unknown-linux-musl","aarch64-unknown-linux-musl","x86_64-apple-darwin","aarch64-apple-darwin","x86_64-pc-windows-msvc","aarch64-pc-windows-msvc"]' |
| 161 | + environment: dev.ocx.sh |
| 162 | + secrets: |
| 163 | + REGISTRY_USER: ${{ secrets.REGISTRY_USER }} |
| 164 | + REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} |
0 commit comments