From d85b12f9f72b0d1a607977fbc98be6b732b85209 Mon Sep 17 00:00:00 2001 From: hisbaan Date: Tue, 6 Feb 2024 14:12:18 -0500 Subject: [PATCH] Add workflow to build distribution packages on release --- .github/workflows/build-package.yml | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/build-package.yml diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml new file mode 100644 index 0000000..f6ae720 --- /dev/null +++ b/.github/workflows/build-package.yml @@ -0,0 +1,32 @@ +name: build-package +on: + release: + types: [published] + branches: [main] +env: + CARGO_TERM_COLOR: always + RUSTUP_TOOLCHAIN: stable + CARGO_TARGET_DIR: target + PLATFORM: ${{ matrix.os == 'macos-latest' && 'apple-darwin' || 'linux-gnu' }} +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Build + run: cargo build --locked --release + - name: Strip binary + run: strip target/release/dym + - name: Move the binary + run: cp target/release/dym . + - name: Create TAR package + run: tar -czvf dym-$(target/release/dym --version | cut -d ' ' -f 2)-x86_64-${PLATFORM}.tar.gz completions docs man dym + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: dym-$(target/release/dym --version | cut -d ' ' -f 2)-x86_64-${PLATFORM}.tar.gz