From db9e65c1a64a71dca0599d570d6fe9cd3a9d5e93 Mon Sep 17 00:00:00 2001 From: "Victor M. Alvarez" Date: Mon, 25 Mar 2024 15:47:09 +0100 Subject: [PATCH] ci: add workflow for automatic creation of releases --- .github/workflows/release.yaml | 88 ++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..dd815a5e5 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,88 @@ +name: Release +on: + push: +jobs: + build: + env: + CARGO_TERM_COLOR: always + runs-on: ${{ matrix.os }} + strategy: + matrix: + build: + - linux + - macos + - windows + include: + - build: linux + os: ubuntu-latest + rust: stable + args: "" + + - build: macos + os: macos-latest + rust: stable + args: "" + + - build: windows + os: windows-latest + rust: stable + args: "" + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Install dependencies + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libssl-dev libmagic-dev + + - name: Install dependencies + id: vcpkg + if: runner.os == 'Windows' + uses: johnwason/vcpkg-action@v5 + with: + pkgs: openssl + triplet: x64-windows-release + token: ${{ github.token }} + + - name: Set OPENSSL_DIR environment variable + if: runner.os == 'Windows' + shell: bash + run: echo "OPENSSL_DIR=${{ github.workspace }}\\vcpkg\\installed\\x64-windows-release" >> $GITHUB_ENV + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust }} + + - name: Build + run: cargo build --release --profile release-lto ${{ matrix.args }} + + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: yr-${{ matrix.os }}-${{ matrix.arch }} + path: target/release/yr + + publish: + needs: [ build ] + runs-on: ubuntu-latest + + # Only publish to PyPI on tag pushes + # if: startsWith(github.ref, 'refs/tags/') + + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + pattern: yr-* + merge-multiple: true + path: dist/ + + - name: Release + uses: softprops/action-gh-release@v2 + with: + draft: true + files: yr-*