name: Release on: push: tags: ["v*"] permissions: contents: write env: CARGO_TERM_COLOR: always jobs: build: name: Build ${{ matrix.target }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: # Linux - os: ubuntu-latest target: x86_64-unknown-linux-gnu artifact: sshell-x86_64-linux - os: ubuntu-latest target: aarch64-unknown-linux-gnu artifact: sshell-aarch64-linux # macOS - os: macos-latest target: aarch64-apple-darwin artifact: sshell-aarch64-macos - os: macos-13 target: x86_64-apple-darwin artifact: sshell-x86_64-macos # Windows - os: windows-latest target: x86_64-pc-windows-msvc artifact: sshell-x86_64-windows.exe - os: windows-latest target: aarch64-pc-windows-msvc artifact: sshell-aarch64-windows.exe steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - name: Install cross-compilation tools (Linux aarch64) if: matrix.target == 'aarch64-unknown-linux-gnu' run: | sudo apt-get update sudo apt-get install -y gcc-aarch64-linux-gnu - uses: Swatinem/rust-cache@v2 with: key: ${{ matrix.target }} - name: Build run: cargo build --release --target ${{ matrix.target }} - name: Rename binary (Unix) if: runner.os != 'Windows' run: | cp target/${{ matrix.target }}/release/sshell ${{ matrix.artifact }} chmod +x ${{ matrix.artifact }} - name: Rename binary (Windows) if: runner.os == 'Windows' run: | copy target\${{ matrix.target }}\release\sshell.exe ${{ matrix.artifact }} - name: Upload artifact uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact }} path: ${{ matrix.artifact }} release: name: Create GitHub Release needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: path: artifacts merge-multiple: true - name: Create release uses: softprops/action-gh-release@v2 with: generate_release_notes: true files: artifacts/*