chore(deps): 升级依赖 #95
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: build (${{ matrix.build }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| build: | |
| - linux-arm64 | |
| - linux-64bit | |
| - linux-32bit | |
| - macos-arm64 | |
| - macos-64bit | |
| - windows-64bit | |
| - windows-32bit | |
| - windows-arm64 | |
| include: | |
| - build: linux-arm64 | |
| os: ubuntu-latest | |
| target: aarch64-unknown-linux-musl | |
| use-cross: true | |
| - build: linux-64bit | |
| os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| use-cross: true | |
| - build: linux-32bit | |
| os: ubuntu-latest | |
| target: i686-unknown-linux-musl | |
| use-cross: true | |
| - build: macos-arm64 | |
| os: macos-14 | |
| target: aarch64-apple-darwin | |
| use-cross: false | |
| - build: macos-64bit | |
| os: macos-14 | |
| target: x86_64-apple-darwin | |
| use-cross: false | |
| - build: windows-64bit | |
| os: windows-2022 | |
| target: x86_64-pc-windows-msvc | |
| use-cross: false | |
| - build: windows-32bit | |
| os: windows-2022 | |
| target: i686-pc-windows-msvc | |
| use-cross: false | |
| - build: windows-arm64 | |
| os: windows-2022 | |
| target: aarch64-pc-windows-msvc | |
| use-cross: false | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Rust Cache | |
| uses: swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.target }} | |
| - name: Install NASM | |
| if: startsWith(matrix.build, 'windows-') | |
| uses: ilammy/setup-nasm@v1 | |
| - name: Install Cross | |
| if: matrix.use-cross | |
| uses: taiki-e/install-action@cross | |
| - name: Build binary | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.use-cross }}" == "true" ]; then | |
| cross build --verbose --release --target ${{ matrix.target }} | |
| else | |
| cargo build --verbose --release --target ${{ matrix.target }} | |
| fi | |
| env: | |
| RUST_BACKTRACE: 1 | |
| - name: Prepare Binary | |
| shell: bash | |
| run: | | |
| BIN_NAME="fd" | |
| if [[ "${{ matrix.build }}" == windows-* ]]; then | |
| EXE_NAME="${BIN_NAME}.exe" | |
| NEW_NAME="${BIN_NAME}-${{ matrix.build }}.exe" | |
| else | |
| EXE_NAME="${BIN_NAME}" | |
| NEW_NAME="${BIN_NAME}-${{ matrix.build }}" | |
| fi | |
| mkdir -p ./artifacts/ | |
| cp "target/${{ matrix.target }}/release/${EXE_NAME}" "./artifacts/${NEW_NAME}" | |
| echo "ASSET_PATH=./artifacts/${NEW_NAME}" >> $GITHUB_ENV | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.build }} | |
| path: ${{ env.ASSET_PATH }} | |
| retention-days: 1 | |
| release: | |
| name: Create Release | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./all-artifacts | |
| merge-multiple: true | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ./all-artifacts/* | |
| generate_release_notes: true |