Skip to content

Commit

Permalink
GitHub Actions for Automated Builds (#11)
Browse files Browse the repository at this point in the history
* Create rust.yml

* Update rust.yml

* Added openssl as dependency

* Update rust.yml

* Create build-release.yml

* Delete rust.yml

* Update build-release.yml

* Better release names

* Update build-release.yml

* Update build-release.yml

* Reduce Windows release

* Update Cargo.toml

* Added Raspberry Pi Release

* Update Cargo.toml

* Better pi release naming
  • Loading branch information
CodeChronicle1 authored Jun 27, 2023
1 parent d55737f commit 672992d
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }

0 comments on commit 672992d

Please sign in to comment.