1name: Continuous Deployment 2 3on: 4 push: 5 tags: 6 - "v*.*.*" 7 8jobs: 9 publish: 10 name: Publishing for ${{ matrix.os }} 11 runs-on: ${{ matrix.os }} 12 strategy: 13 matrix: 14 os: [macos-latest, ubuntu-latest, windows-latest] 15 rust: [stable] 16 include: 17 - os: macos-latest 18 artifact_prefix: macos 19 target: x86_64-apple-darwin 20 binary_postfix: "" 21 - os: ubuntu-latest 22 artifact_prefix: linux 23 target: x86_64-unknown-linux-gnu 24 binary_postfix: "" 25 - os: windows-latest 26 artifact_prefix: windows 27 target: x86_64-pc-windows-msvc 28 binary_postfix: ".exe" 29 30 steps: 31 - name: Installing Rust toolchain 32 uses: actions-rs/toolchain@v1 33 with: 34 toolchain: ${{ matrix.rust }} 35 override: true 36 - name: Installing needed macOS dependencies 37 if: matrix.os == 'macos-latest' 38 run: brew install openssl@1.1 39 - name: Installing needed Ubuntu dependencies 40 if: matrix.os == 'ubuntu-latest' 41 run: | 42 sudo apt-get update 43 sudo apt-get install -y -qq pkg-config libssl-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev 44 - name: Checking out sources 45 uses: actions/checkout@v1 46 - name: Running cargo build 47 uses: actions-rs/cargo@v1 48 with: 49 command: build 50 toolchain: ${{ matrix.rust }} 51 args: --release --target ${{ matrix.target }} 52 53 - name: Packaging final binary 54 shell: bash 55 run: | 56 cd target/${{ matrix.target }}/release 57 58 BINARY_NAME=spt${{ matrix.binary_postfix }} 59 strip $BINARY_NAME 60 61 RELEASE_NAME=spotify-tui-${{ matrix.artifact_prefix }} 62 tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME 63 64 if [[ ${{ runner.os }} == 'Windows' ]]; then 65 certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256 66 else 67 shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256 68 fi 69 - name: Releasing assets 70 uses: softprops/action-gh-release@v1 71 with: 72 files: | 73 target/${{ matrix.target }}/release/spotify-tui-${{ matrix.artifact_prefix }}.tar.gz 74 target/${{ matrix.target }}/release/spotify-tui-${{ matrix.artifact_prefix }}.sha256 75 env: 76 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 77 78 publish-cargo: 79 name: Publishing to Cargo 80 runs-on: ubuntu-latest 81 steps: 82 - uses: actions/checkout@master 83 - uses: actions-rs/toolchain@v1 84 with: 85 toolchain: stable 86 override: true 87 - run: | 88 sudo apt-get update 89 sudo apt-get install -y -qq pkg-config libssl-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev 90 - uses: actions-rs/cargo@v1 91 with: 92 command: publish 93 args: --token ${{ secrets.CARGO_API_KEY }} --allow-dirty 94