feat: enhance FreeBSD, OpenBSD, and NetBSD build processes in release workflow

This commit is contained in:
2026-05-27 20:42:30 +08:00
parent a55d64c5ff
commit e3c35793ec

View File

@@ -199,12 +199,6 @@ jobs:
if: ${{ github.event_name == 'push' || github.event.inputs.run_bsd == 'true' }} if: ${{ github.event_name == 'push' || github.event.inputs.run_bsd == 'true' }}
needs: [setup, notes] needs: [setup, notes]
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-freebsd
# При необходимости сюда можно докинуть x86_64-unknown-netbsd
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@@ -221,25 +215,56 @@ jobs:
pip install cargo-zigbuild pip install cargo-zigbuild
echo "$HOME/.local/bin" >> $GITHUB_PATH echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Setup Rust - name: Setup Rust (FreeBSD)
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
targets: ${{ matrix.target }} targets: x86_64-unknown-freebsd
- name: Build - name: Build FreeBSD
run: cargo zigbuild --release --target ${{ matrix.target }} run: cargo zigbuild --release --target x86_64-unknown-freebsd
- name: Prepare Artifact - name: Prepare FreeBSD Artifact
run: | run: |
ASSET="dcr-${{ matrix.target }}-${{ needs.setup.outputs.version }}" ASSET="dcr-x86_64-unknown-freebsd-${{ needs.setup.outputs.version }}"
cp target/${{ matrix.target }}/release/dcr "$ASSET" cp target/x86_64-unknown-freebsd/release/dcr "$ASSET"
echo "ASSET_NAME=${ASSET}" >> "$GITHUB_ENV" echo "FREEBSD_ASSET=${ASSET}" >> "$GITHUB_ENV"
- name: Upload Release Asset - name: Build in OpenBSD VM
uses: vmactions/openbsd-vm@v1
with:
usesh: true
run: |
pkg_add rust
cargo build --release
- name: Prepare OpenBSD Artifact
run: |
ASSET="dcr-x86_64-unknown-openbsd-${{ needs.setup.outputs.version }}"
cp target/release/dcr "$ASSET"
echo "OPENBSD_ASSET=${ASSET}" >> "$GITHUB_ENV"
- name: Build in NetBSD VM
uses: vmactions/netbsd-vm@v1
with:
usesh: true
run: |
pkgin -y install rust
cargo build --release
- name: Prepare NetBSD Artifact
run: |
ASSET="dcr-x86_64-unknown-netbsd-${{ needs.setup.outputs.version }}"
cp target/release/dcr "$ASSET"
echo "NETBSD_ASSET=${ASSET}" >> "$GITHUB_ENV"
- name: Upload Release Assets
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
tag_name: ${{ needs.setup.outputs.tag }} tag_name: ${{ needs.setup.outputs.tag }}
files: ${{ env.ASSET_NAME }} files: |
${{ env.FREEBSD_ASSET }}
${{ env.OPENBSD_ASSET }}
${{ env.NETBSD_ASSET }}
body_path: .github/release-notes.md body_path: .github/release-notes.md
prerelease: ${{ needs.setup.outputs.prerelease == 'true' }} prerelease: ${{ needs.setup.outputs.prerelease == 'true' }}