dist #4
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: dist | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| dist: | |
| name: dist (${{ matrix.target }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| code-target: win32-x64 | |
| - os: windows-latest | |
| target: i686-pc-windows-msvc | |
| code-target: win32-x64 | |
| - os: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| code-target: win32-arm64 | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| code-target: linux-x64 | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| code-target: linux-arm64 | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| code-target: darwin-x64 | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| code-target: darwin-arm64 | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| target: ${{matrix.target}} | |
| - name: Install GCC arm64 (linux) | |
| if: startsWith(matrix.target, 'aarch64-unknown-linux') | |
| run: sudo apt-get update && sudo apt-get install gcc-aarch64-linux-gnu | |
| - run: cargo build --target ${{ matrix.target }} --release | |
| env: | |
| CC: aarch64-linux-gnu-gcc | |
| CXX: aarch64-linux-gnu-g++ | |
| LD: aarch64-linux-gnu-ld | |
| AR: aarch64-linux-gnu-ar | |
| if: startsWith(matrix.target, 'aarch64-unknown-linux') | |
| - run: cargo build --target ${{ matrix.target }} --release | |
| if: ${{ !startsWith(matrix.target, 'aarch64-unknown-linux') }} | |
| - name: Archive | |
| shell: bash | |
| run: | | |
| ver=${GITHUB_REF/refs\/*\//} | |
| archive="dist/cargo-nfpm-$ver-${{ matrix.target }}" | |
| mkdir -p dist | |
| if [ "${{ matrix.os }}" == "windows-latest" ]; then | |
| 7z a "${archive}.zip" target/${{ matrix.target }}/release/cargo-nfpm.exe | |
| else | |
| tar czf "${archive}.tar.gz" -C target/${{ matrix.target }}/release cargo-nfpm | |
| fi | |
| ls -lah dist/* | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.target }} | |
| path: dist |