mirror of
https://github.com/rustfs/rustfs.git
synced 2026-06-20 21:46:01 +08:00
133 lines
4.7 KiB
YAML
133 lines
4.7 KiB
YAML
name: Build
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: '0 0 * * 0' # at midnight of each sunday
|
|
push:
|
|
branches:
|
|
- main
|
|
tags: [ 'v*', '*' ]
|
|
|
|
jobs:
|
|
build-rustfs:
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
variant:
|
|
- { profile: dev, target: x86_64-unknown-linux-gnu, glibc: "default" }
|
|
- { profile: release, target: x86_64-unknown-linux-gnu, glibc: "default" }
|
|
- { profile: release, target: x86_64-unknown-linux-gnu, glibc: "2.31" }
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup
|
|
with:
|
|
cache-shared-key: rustfs.${{ matrix.variant.profile }}.${{ matrix.variant.target }}.${{ matrix.variant.glibc }}
|
|
|
|
- name: Download and Extract Static Assets
|
|
run: |
|
|
url="https://dl.rustfs.com/console/rustfs-console-latest.zip"
|
|
mkdir -p static
|
|
curl -L -o static_assets.zip "$url"
|
|
unzip -o static_assets.zip -d ./rustfs/static
|
|
rm static_assets.zip
|
|
ls -la ./rustfs/static
|
|
|
|
- name: Build
|
|
run: |
|
|
./scripts/build.py \
|
|
--profile ${{ matrix.variant.profile }} \
|
|
--target ${{ matrix.variant.target }} \
|
|
--glibc ${{ matrix.variant.glibc }}
|
|
|
|
- name: Package Binary and Static Assets
|
|
id: package
|
|
run: |
|
|
# Create artifact filename
|
|
ARTIFACT_NAME="rustfs-${{ matrix.variant.profile }}-${{ matrix.variant.target }}"
|
|
if [ "${{ matrix.variant.glibc }}" != "default" ]; then
|
|
ARTIFACT_NAME="${ARTIFACT_NAME}-glibc${{ matrix.variant.glibc }}"
|
|
fi
|
|
echo "artifact_name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
|
|
|
|
# Determine binary path
|
|
bin_path="target/artifacts/rustfs.${{ matrix.variant.profile }}.${{ matrix.variant.target }}.bin"
|
|
if [ -f "target/artifacts/rustfs.${{ matrix.variant.profile }}.${{ matrix.variant.target }}.glibc${{ matrix.variant.glibc }}.bin" ]; then
|
|
bin_path="target/artifacts/rustfs.${{ matrix.variant.profile }}.${{ matrix.variant.target }}.glibc${{ matrix.variant.glibc }}.bin"
|
|
fi
|
|
|
|
# Create package
|
|
mkdir -p ${ARTIFACT_NAME}
|
|
cp "$bin_path" ${ARTIFACT_NAME}/rustfs
|
|
zip -r ${ARTIFACT_NAME}.zip ${ARTIFACT_NAME}
|
|
ls -la
|
|
|
|
# Copy files to the specified directory
|
|
mkdir -p cli/rustfs-gui/embedded-rustfs
|
|
cp -r ${ARTIFACT_NAME}/rustfs cli/rustfs-gui/embedded-rustfs/
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ steps.package.outputs.artifact_name }}
|
|
path: ${{ steps.package.outputs.artifact_name }}.zip
|
|
retention-days: 7
|
|
|
|
build-rustfs-gui:
|
|
runs-on: ubuntu-latest
|
|
needs: build-rustfs
|
|
|
|
strategy:
|
|
matrix:
|
|
variant:
|
|
- { profile: release, target: x86_64-unknown-linux-gnu }
|
|
# if: startsWith(github.ref, 'refs/tags/')
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Cache dioxus-cli
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cargo/bin/dx
|
|
key: ${{ runner.os }}-dioxus-cli-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-dioxus-cli-
|
|
|
|
- name: Install dioxus-cli
|
|
run: |
|
|
if [ ! -f ~/.cargo/bin/dx ]; then
|
|
cargo install dioxus-cli
|
|
fi
|
|
|
|
- name: Build and Bundle rustfs-gui
|
|
run: |
|
|
relaese_path = "target/${{ matrix.variant.target }}"
|
|
mkdir -p ${relaese_path}
|
|
cd cli/rustfs-gui
|
|
if [[ "${{ matrix.variant.target }}" == *"apple-darwin"* ]]; then
|
|
dx bundle --platform macos --package-types "macos" --package-types "dmg" --package-types "ios" --release --profile release --out-dir ../../${relaese_path}
|
|
elif [[ "${{ matrix.variant.target }}" == *"windows-msvc"* ]]; then
|
|
dx bundle --platform windows --package-types "msi" --release --profile release --out-dir ../../${relaese_path}
|
|
fi
|
|
cd ../..
|
|
GUI_ARTIFACT_NAME="rustfs-gui-${{ matrix.variant.profile }}-${{ matrix.variant.target }}"
|
|
zip -r ${GUI_ARTIFACT_NAME}.zip ${relaese_path}/rustfs-gui
|
|
echo "gui_artifact_name=${GUI_ARTIFACT_NAME}" >> $GITHUB_OUTPUT
|
|
ls -la ${relaese_path}
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ steps.package.outputs.gui_artifact_name }}
|
|
path: ${{ steps.package.outputs.gui_artifact_name }}.zip
|
|
retention-days: 7
|
|
|
|
merge:
|
|
runs-on: ubuntu-latest
|
|
needs: [ build-rustfs, build-rustfs-gui ]
|
|
steps:
|
|
- uses: actions/upload-artifact/merge@v4
|
|
with:
|
|
name: rustfs-packages
|
|
pattern: 'rustfs-*'
|
|
delete-merged: true
|