diff --git a/.github/workflows/buildrelease.yml b/.github/workflows/buildrelease.yml new file mode 100644 index 0000000..161b000 --- /dev/null +++ b/.github/workflows/buildrelease.yml @@ -0,0 +1,94 @@ +name: Publish utilities on release + +on: + push: + tags: [ 'utils-*.*.*' ] + +env: + BINARIES: "--bin czutil --bin pakutil" + +permissions: + contents: write + +jobs: + build: + name: Build binaries for Windows and Linux + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v3 + + - name: 'Set up Rust environment' + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + targets: x86_64-pc-windows-gnu, x86_64-unknown-linux-gnu + + - name: 'Cache Rust dependencies' + uses: actions/cache@v4 + with: + path: target + key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-build- + + - name: '📦 Package Windows x86_64' + run: | + cd ${{github.workspace}} + cargo build --profile production --target x86_64-pc-windows-gnu $BINARIES + zip lbee-utils_Windows-x86_64.zip target/x86_64-pc-windows-gnu/production/czutil.exe target/x86_64-pc-windows-gnu/production/pakutil.exe + gh release upload ${{github.event.release.tag_name}} lbee-utils_Windows-x86_64.zip + env: + GITHUB_TOKEN: ${{ github.TOKEN }} + shell: bash + + - name: '📦 Package Linux x86_64' + run: | + cd ${{github.workspace}} + cargo build --profile production --target x86_64-unknown-linux-gnu $BINARIES + zip lbee-utils_Linux-x86_64.zip target/x86_64-unknown-linux-gnu/production/czutil.exe target/x86_64-unknown-linux-gnu/production/pakutil.exe + gh release upload ${{github.event.release.tag_name}} lbee-utils_Linux-x86_64.zip + env: + GITHUB_TOKEN: ${{ github.TOKEN }} + shell: bash + + build-mac: + name: Build binaries for MacOS + runs-on: macos-14 + steps: + + - uses: actions/checkout@v3 + + - name: 'Set up Rust environment' + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + targets: x86_64-apple-darwin, aarch64-apple-darwin + + - name: 'Cache Rust dependencies' + uses: actions/cache@v4 + with: + path: target + key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-build- + + - name: '📦 Package MacOS x86_64' + run: | + cd ${{github.workspace}} + cargo build --profile production --target x86_64-apple-darwin $BINARIES + zip lbee-utils_Mac-x86_64.zip target/x86_64-apple-darwin/production/czutil.exe target/x86_64-apple-darwin/production/pakutil.exe + gh release upload ${{github.event.release.tag_name}} lbee-utils_Mac-x86_64.zip + env: + GITHUB_TOKEN: ${{ github.TOKEN }} + shell: bash + + - name: '📦 Package MacOS Arm' + run: | + cd ${{github.workspace}} + cargo build --profile production --target aarch64-apple-darwin $BINARIES + zip lbee-utils_Mac-Arm.zip target/aarch64-apple-darwin/production/czutil.exe target/aarch64-apple-darwin/production/pakutil.exe + gh release upload ${{github.event.release.tag_name}} lbee-utils_Mac-Arm.zip + env: + GITHUB_TOKEN: ${{ github.TOKEN }} + shell: bash