Skip to content

Fix CI: skip timeout test on Windows, fix audit job permissions #7

Fix CI: skip timeout test on Windows, fix audit job permissions

Fix CI: skip timeout test on Windows, fix audit job permissions #7

Workflow file for this run

name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
artifact: affected
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
artifact: affected
- target: x86_64-apple-darwin
os: macos-latest
artifact: affected
- target: aarch64-apple-darwin
os: macos-latest
artifact: affected
- target: x86_64-pc-windows-msvc
os: windows-latest
artifact: affected.exe
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- run: cargo build --release --target ${{ matrix.target }} --features vendored-openssl
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Package
shell: bash
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../affected-${{ matrix.target }}.tar.gz ${{ matrix.artifact }}
- uses: actions/upload-artifact@v4
with:
name: affected-${{ matrix.target }}
path: affected-${{ matrix.target }}.tar.gz
- uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.target }}
path: target/${{ matrix.target }}/release/${{ matrix.artifact }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: affected-*
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
files: "*.tar.gz"
generate_release_notes: true
pypi:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v4
with:
pattern: binary-*
path: binaries/
- name: Build platform wheels
run: |
VERSION="${{ steps.version.outputs.version }}"
for target_dir in binaries/binary-*; do
target=$(basename "$target_dir" | sed 's/^binary-//')
binary=$(find "$target_dir" -type f | head -1)
python python/build_wheels.py "$target" "$binary" "$VERSION" dist/
done
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
crates-io:
name: Publish to crates.io
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Publish affected-core
run: cargo publish -p affected-core
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish affected-cli
run: cargo publish -p affected-cli
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}