name: Build and Release on: push: branches: - master jobs: build-linux: runs-on: debian-bookworm steps: - name: Install Rust + Python + maturin run: | apt-get update && apt-get install -y python3 python3-pip curl curl https://sh.rustup.rs -sSf | sh -s -- -y source $HOME/.cargo/env pip3 install maturin --break-system-packages - name: Build Linux Wheel run: | source $HOME/.cargo/env maturin build --release --interpreter python3 - name: Upload Linux wheel uses: actions/upload-artifact@v4 with: name: wheel-linux path: target/wheels/*.whl build-windows: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Docker run: | sudo apt-get update && sudo apt-get install -y docker.io - name: Build Windows Wheel with maturin in cross container run: | docker run --rm -v $PWD:/project -w /project ghcr.io/cross-rs/x86_64-pc-windows-gnu \ bash -c "pip3 install maturin && maturin build --release --target x86_64-pc-windows-gnu" - name: Upload Windows wheel uses: actions/upload-artifact@v4 with: name: wheel-windows path: target/wheels/*win_amd64.whl release: needs: [build-linux, build-windows] runs-on: ubuntu-latest steps: - uses: actions/download-artifact@v4 with: name: wheel-linux path: dist/ - uses: actions/download-artifact@v4 with: name: wheel-windows path: dist/ - name: Get Version id: version run: | version=$(grep '^version' Cargo.toml | head -n1 | cut -d'"' -f2) echo "version=$version" >> "$GITHUB_OUTPUT" - name: Generate changelog from commits id: changelog run: | log=$(git log --pretty=format:"- %s (%h)" $(git describe --tags --abbrev=0)..HEAD) echo "$log" > changes.md echo "log<> "$GITHUB_OUTPUT" echo "$log" >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" - name: Create Gitea Release uses: https://gitea.com/actions/create-release@v1 with: tag: v${{ steps.version.outputs.version }} title: Release v${{ steps.version.outputs.version }} note: ${{ steps.changelog.outputs.log }} env: RUNNER_TOKEN: ${{ secrets.RUNNER_TOKEN }} - name: Upload release assets uses: https://gitea.com/actions/upload-release-asset@v1 with: tag: v${{ steps.version.outputs.version }} file: dist/*.whl env: RUNNER_TOKEN: ${{ secrets.RUNNER_TOKEN }}