fix for windows #41
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
push: | |
# Enable when testing release infrastructure on a branch. | |
# branches: | |
# - gh-actions | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Override version - useful to test workflows' | |
required: true | |
jobs: | |
create-release: | |
name: create-release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create artifacts directory | |
run: mkdir artifacts | |
- name: Mark manual | |
if: inputs.version != '' | |
run: | | |
echo "MANUAL=1" >> $GITHUB_ENV | |
- name: Get the release version from the tag | |
if: env.VERSION == '' | |
run: | | |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
echo "version is: ${{ env.VERSION }}" | |
- name: Create GitHub release | |
id: release | |
if: env.MANUAL != '1' | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.VERSION }} | |
release_name: ${{ env.VERSION }} | |
- name: Save release upload URL to artifact | |
run: echo "${{ steps.release.outputs.upload_url }}" > artifacts/release-upload-url | |
- name: Save version number to artifact | |
run: echo "${{ env.VERSION }}" > artifacts/release-version | |
- name: Upload artifacts | |
if: env.MANUAL != '1' | |
uses: actions/upload-artifact@v1 | |
with: | |
name: artifacts | |
path: artifacts | |
build-release: | |
name: build-release | |
needs: ["create-release"] | |
runs-on: ${{ matrix.os }} | |
env: | |
TARGET_DIR: ./target | |
RUST_BACKTRACE: 1 | |
MACOSX_DEPLOYMENT_TARGET: 10.9 | |
strategy: | |
matrix: | |
build: [linux, linux-aarch64, linux-static, macos-aarch64, macos-x86, windows] | |
include: | |
- build: linux | |
os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
- build: linux-aarch64 | |
os: ubuntu-20.04 | |
target: aarch64-unknown-linux-gnu | |
- build: linux-static | |
os: ubuntu-20.04 | |
target: x86_64-unknown-linux-musl | |
- build: macos-aarch64 | |
os: macos-14 | |
target: aarch64-apple-darwin | |
- build: macos-x86 | |
os: macos-13 | |
target: x86_64-apple-darwin | |
- build: windows | |
os: windows-2019 | |
target: x86_64-pc-windows-msvc | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: 1.80.0 | |
targets: ${{ matrix.target }} | |
components: llvm-tools | |
- name: Setup Rust environment | |
shell: bash | |
run: | | |
echo "RUSTUP_HOME=$HOME/.rustup" >> $GITHUB_ENV | |
echo "CARGO_HOME=$HOME/.cargo" >> $GITHUB_ENV | |
LLVM_TOOLS_PATH=$(rustc --print sysroot)/lib/rustlib/${{ matrix.target }}/bin | |
echo "PATH=$LLVM_TOOLS_PATH:$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV | |
- name: Set up Homebrew (macOS only) | |
if: runner.os == 'macOS' | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Install LLVM 18 (macOS only) | |
if: runner.os == 'macOS' | |
run: | | |
brew install llvm@18 | |
echo "$(brew --prefix llvm@18)/bin" >> $GITHUB_PATH | |
- name: Install Cross toolchain (zig) | |
if: matrix.build == 'macos-aarch64' || matrix.build == 'linux-aarch64' | |
uses: goto-bus-stop/setup-zig@v2 | |
with: | |
version: 0.11.0 | |
- name: Get release download URL | |
if: env.MANUAL != '1' | |
uses: actions/download-artifact@v1 | |
with: | |
name: artifacts | |
path: artifacts | |
- name: Set release upload URL and release version | |
if: env.MANUAL != '1' | |
shell: bash | |
run: | | |
release_upload_url="$(cat artifacts/release-upload-url)" | |
echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV | |
echo "release upload url: $RELEASE_UPLOAD_URL" | |
release_version="$(cat artifacts/release-version)" | |
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV | |
echo "release version: $RELEASE_VERSION" | |
- name: Build PGO Binary (Linux) | |
if: matrix.build == 'linux' | |
shell: bash | |
run: | | |
export TARGET=${{ matrix.target }} | |
./build_pgo.sh | |
env: | |
HOME: ${{ github.workspace }} | |
- name: Build PGO Binary (macOS) | |
if: matrix.build == 'macos-x86' || matrix.build == 'macos-aarch64' | |
run: | | |
export TARGET=${{ matrix.target }} | |
./build_pgo.sh | |
env: | |
HOME: ${{ github.workspace }} | |
- name: Build release binary (linux MUSL) | |
if: matrix.build == 'linux-static' | |
run: cargo build --target ${{ matrix.target }} --release | |
- name: Build release binary (Windows) | |
if: matrix.build == 'windows' | |
run: cargo build --target ${{ matrix.target }} --release --features fast-alloc | |
- name: Build release binary (Linux AARCH64) | |
if: matrix.build == 'linux-aarch64' | |
run: | | |
cargo install cargo-zigbuild | |
cargo zigbuild --target ${{ matrix.target }} --release --features fast-alloc | |
- name: Build archive | |
shell: bash | |
run: | | |
if [ "${{ matrix.build }}" = "windows" ]; then | |
echo "ASSET=target/${{ matrix.target }}/release/evtx_dump.exe" >> $GITHUB_ENV | |
echo "ASSET_NAME=evtx_dump-${{ env.RELEASE_VERSION }}.exe" >> $GITHUB_ENV | |
else | |
echo "ASSET=target/${{ matrix.target }}/release/evtx_dump" >> $GITHUB_ENV | |
echo "ASSET_NAME=evtx_dump-${{ env.RELEASE_VERSION }}-${{ matrix.target }}" >> $GITHUB_ENV | |
fi | |
- name: Upload release archive | |
uses: actions/[email protected] | |
if: env.MANUAL != '1' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ env.RELEASE_UPLOAD_URL }} | |
asset_path: ${{ env.ASSET }} | |
asset_name: ${{ env.ASSET_NAME }} | |
asset_content_type: application/octet-stream |