diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..081dfb4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,59 @@ +name: Release +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" +jobs: + deploy: + # A strategy is used to define various build environments this job will run. + # + # To say it simple, this will create 3 separate independent jobs which will + # run on ubuntu, mac & windows. + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + - name: Build + run: cargo build --release + + - name: Build for Mac + if: matrix.os == 'macos-latest' + run: | + strip target/release/rhack + mkdir -p release + tar -C ./target/release/ -czvf ./release/rhack-mac.tar.gz ./rhack + + - name: Build for Linux + if: matrix.os == 'ubuntu-latest' + run: | + cargo install cargo-deb + cargo deb + strip target/release/rhack + mkdir -p release + mv target/debian/*.deb ./release/rhack-linux.deb + tar -C ./target/release/ -czvf ./release/rhack-linux.tar.gz ./rhack + + - name: Build for Windows + if: matrix.os == 'windows-latest' + run: | + mkdir -p release + tar -C ./target/release/ -czvf ./release/rhack-win.tar.gz ./rhack.exe + + - name: Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + files: | + ./release/*.tar.gz + ./release/*.zip + ./release/*.deb + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file