Skip to content

Release

Release #59

Workflow file for this run

name: Release
on:
create:
tags:
- 'v*'
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
target: x86_64-unknown-linux-gnu
vcpkg_openssl_triplet: x64-linux-release
args: "--features=openssl-static"
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
vcpkg_openssl_triplet: x64-osx-release
args: "--features=openssl-static"
- build: windows
os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
vcpkg_openssl_triplet: x64-windows-static
args: ""
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Check version number
shell: bash
run: |
set -ex
version=`cargo pkgid --manifest-path lib/Cargo.toml | cut -d "@" -f2`
if [ "${{ github.ref_name }}" != "v$version" ]; then
exit 1
fi
- name: Install dependencies
id: vcpkg
uses: johnwason/vcpkg-action@v6
with:
pkgs: openssl
triplet: ${{ matrix.vcpkg_openssl_triplet }}
token: ${{ github.token }}
- name: Build
run: cargo build --bin yr --profile release-lto --target ${{ matrix.target }} ${{ matrix.args }}
env:
RUSTFLAGS: "-C target-feature=+crt-static"
OPENSSL_DIR: "${{ github.workspace }}/vcpkg/installed/${{ matrix.vcpkg_openssl_triplet }}"
- name: Build archive
shell: bash
run: |
set -ex
pkgname=yara-x-${{ github.ref_name }}-${{ matrix.target }}
if [ "${{ matrix.build }}" = "windows" ]; then
7z a $pkgname.zip ./target/${{ matrix.target }}/release-lto/yr.exe
else
tar czf $pkgname.gzip -C target/${{ matrix.target }}/release-lto yr
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: yr-${{ matrix.target }}
path: yara-x-*
publish:
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: yr-*
- name: ls
shell: bash
run: ls
- name: Release
uses: softprops/action-gh-release@v2
with:
draft: true
files: yr-*/yara-x-*