diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000..b68c3ea --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,92 @@ +name: release-binaries +on: + release: + types: [published] +env: + BINARY_NAME: media-cleaner +permissions: + contents: write +jobs: + linux-x86_64: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + default: true + + - name: Build binary + uses: actions-rs/cargo@v1 + with: + command: build + args: --release --target x86_64-unknown-linux-musl + use-cross: true + + - name: Optimize and package binary + run: | + cd target/x86_64-unknown-linux-musl/release + strip ${{ env.BINARY_NAME }} + chmod +x ${{ env.BINARY_NAME }} + tar -c ${{ env.BINARY_NAME }} | gzip > ${{ env.BINARY_NAME }}-${{ github.ref_name }}-linux-x86_64.tar.gz + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: target/x86_64-unknown-linux-musl/release/${{ env.BINARY_NAME }}-${{ github.ref_name }}-linux-x86_64.tar.gz + + linux-armv7: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + default: true + + - name: Build binary + uses: actions-rs/cargo@v1 + with: + command: build + args: --release --target armv7-unknown-linux-gnueabihf + use-cross: true + + - name: Optimize and package binary + run: | + cd target/armv7-unknown-linux-gnueabihf/release + chmod +x ${{ env.BINARY_NAME }} + tar -c ${{ env.BINARY_NAME }} | gzip > ${{ env.BINARY_NAME }}-${{ github.ref_name }}-linux-armv7.tar.gz + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: target/armv7-unknown-linux-gnueabihf/release/${{ env.BINARY_NAME }}-${{ github.ref_name }}-linux-armv7.tar.gz + + windows-x86_64: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + default: true + + - name: Build binary + uses: actions-rs/cargo@v1 + with: + command: build + args: --release + use-cross: true + + - run: Compress-Archive -Path target/release/${{ env.BINARY_NAME }}.exe -Destination ${{ env.BINARY_NAME }}-${{ github.ref_name }}-windows-x86_64.zip + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: ${{ env.BINARY_NAME }}-${{ github.ref_name }}-windows-x86_64.zip diff --git a/Cargo.toml b/Cargo.toml index 6d54dd9..d35c9df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,3 +19,4 @@ serde_repr = "0.1.10" serde-xml-rs = "0.6.0" serde_yaml = "0.9.17" tokio = { version = "1.25.0", features = ["rt", "macros", "rt-multi-thread"] } +openssl = { version = "0.10", features = ["vendored"] }