1name: CD 2 3on: 4 push: 5 tags: 6 - "v*.*.*" 7 8jobs: 9 publish: 10 name: Publishing ${{ matrix.build_target }} 11 runs-on: ${{ matrix.os }} 12 strategy: 13 matrix: 14 build_target: [linux, macos, windows] 15 include: 16 - build_target: linux 17 os: ubuntu-latest 18 artifact_suffix: linux-x86_64 19 target: x86_64-unknown-linux-gnu 20 features: '' 21 - build_target: macos 22 os: macos-latest 23 artifact_suffix: macos-x86_64 24 target: x86_64-apple-darwin 25 features: '--no-default-features --features portaudio_backend,cursive/pancurses-backend' 26 - build_target: windows 27 os: windows-latest 28 artifact_suffix: windows-x86_64 29 target: x86_64-pc-windows-msvc 30 features: '--no-default-features --features rodio_backend,cursive/pancurses-backend' 31 steps: 32 - name: Install Rust toolchain 33 uses: actions-rs/toolchain@v1 34 with: 35 toolchain: stable 36 override: true 37 target: ${{ matrix.target }} 38 profile: minimal 39 - name: Install macOS dependencies 40 if: matrix.os == 'macos-latest' 41 run: brew install portaudio pkg-config 42 - name: Install Linux dependencies 43 if: matrix.os == 'ubuntu-latest' 44 run: | 45 sudo apt update 46 sudo apt install libpulse-dev libdbus-1-dev libncursesw5-dev libxcb-shape0-dev libxcb-xfixes0-dev 47 - uses: actions/checkout@v2 48 name: Checkout src 49 - uses: actions/cache@v2 50 with: 51 path: | 52 ~/.cargo/registry 53 ~/.cargo/git 54 key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 55 - name: Running cargo build 56 uses: actions-rs/cargo@v1 57 with: 58 command: build 59 args: --locked --release --target ${{ matrix.target }} ${{ matrix.features }} 60 - name: Extract git tag 61 shell: bash 62 run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF#refs/tags/})" 63 id: extract_tag 64 - name: Packaging assets 65 shell: bash 66 run: | 67 cd target/${{ matrix.target }}/release 68 case ${{ matrix.target }} in 69 *-pc-windows-*) 70 7z -y a ncspot-${{ steps.extract_tag.outputs.tag }}-${{ matrix.artifact_suffix }}.zip ncspot.exe 71 sha256sum ncspot-${{ steps.extract_tag.outputs.tag }}-${{ matrix.artifact_suffix }}.zip > ncspot-${{ steps.extract_tag.outputs.tag }}-${{ matrix.artifact_suffix }}.sha256 72 ;; 73 *) 74 strip ncspot 75 tar czvf ncspot-${{ steps.extract_tag.outputs.tag }}-${{ matrix.artifact_suffix }}.tar.gz ncspot 76 shasum -a 256 ncspot-${{ steps.extract_tag.outputs.tag }}-${{ matrix.artifact_suffix }}.tar.gz > ncspot-${{ steps.extract_tag.outputs.tag }}-${{ matrix.artifact_suffix }}.sha256 77 ;; 78 esac; 79 - name: Releasing assets 80 uses: softprops/action-gh-release@v1 81 with: 82 files: target/${{ matrix.target }}/release/ncspot-* 83 env: 84 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 85