Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
outputs:
version: ${{ steps.check.outputs.version }}
is_release: ${{ steps.check.outputs.is_release }}
has_token: ${{ steps.check.outputs.has_token }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -65,12 +66,19 @@ jobs:
echo "ℹ️ Version normalized to: $version"
fi

has_token="false"
if [ -n "${{ secrets.CARGO_REGISTRY_TOKEN }}" ]; then
has_token="true"
fi

echo "version=$version" >> $GITHUB_OUTPUT
echo "is_release=$is_release" >> $GITHUB_OUTPUT
echo "has_token=$has_token" >> $GITHUB_OUTPUT

echo "📊 Build Summary:"
echo " - Version: $version"
echo " - Is release: $is_release"
echo " - Publish crate: $has_token"

build:
name: Build (${{ matrix.os_name }}-${{ matrix.arch }})
Expand All @@ -83,7 +91,7 @@ jobs:
matrix:
include:
# Linux
- os: ubuntu-latest
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
os_name: linux
arch: amd64
Expand All @@ -96,6 +104,20 @@ jobs:
artifact_name: rc
cross: true

- os: ubuntu-latest
target: x86_64-unknown-linux-musl
os_name: linux
arch: amd64-musl
artifact_name: rc
cross: false

- os: ubuntu-latest
target: aarch64-unknown-linux-musl
os_name: linux
arch: arm64-musl
artifact_name: rc
cross: true

# macOS (both targets built on ARM64 runner with cross-compilation)
- os: macos-latest
target: x86_64-apple-darwin
Expand Down Expand Up @@ -130,6 +152,13 @@ jobs:
with:
key: ${{ matrix.target }}

- name: Add Rust target
run: rustup target add ${{ matrix.target }}

- name: Install musl-tools
if: contains(matrix.target, 'musl')
run: sudo apt-get update && sudo apt-get install -y musl-tools

# Install cross for cross-compilation
- name: Install cross
if: matrix.cross
Expand Down Expand Up @@ -407,7 +436,7 @@ jobs:

```bash
brew tap rustfs/homebrew-tap

brew install rustfs/tap/rc
```

Expand All @@ -424,7 +453,7 @@ jobs:
name: Publish to crates.io
needs: [ build-check, build ]
runs-on: ubuntu-latest
if: needs.build-check.outputs.is_release == 'true'
if: needs.build-check.outputs.is_release == 'true' && needs.build-check.outputs.has_token == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down