Skip to content

release

release #53

Workflow file for this run

name: release
on:
workflow_run:
workflows: [build]
branches: [main]
types:
- completed
workflow_dispatch:
jobs:
tag-release:
if: ${{ github.event.workflow_run.conclusion == 'success' }} || ${{ github.event.workflow_dispatch }}
name: tag-release - Python 3.12 (ubuntu-latest)
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
# Set release output variables
- name: Set output
id: vars
run: |
echo "TAG_NAME=v$(scripts/get_version.sh)" >> $GITHUB_ENV
echo "RELEASE_NAME=$(scripts/get_version.sh)" >> $GITHUB_ENV
echo "## Release notes" > NOTES.md
sed -n '/^## /{n; :a; /^## /q; p; n; ba}' CHANGELOG.md >> NOTES.md
# Create GitHub release
- name: Create release
id: create-release
uses: softprops/action-gh-release@v1
with:
name: ${{ env.RELEASE_NAME }}
tag_name: ${{ env.TAG_NAME }}
append_body: true
body_path: ./NOTES.md
prerelease: false
macos-release:
needs: [tag-release]
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
# Cargo setup
- name: Set up Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-x86_64-cargo-${{ hashFiles('Cargo.lock') }}
# Python setup
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build wheels - x86_64
uses: messense/maturin-action@v1
with:
target: x86_64
args: --release --out dist --manifest-path python/Cargo.toml --interpreter python${{ matrix.python-version }}
- name: Build wheels - universal2
uses: messense/maturin-action@v1
with:
args: --release --target universal2-apple-darwin --out dist --manifest-path python/Cargo.toml --interpreter python${{ matrix.python-version }}
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
windows-release:
needs: [tag-release]
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
# Cargo setup
- name: Set up Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-x86_64-cargo-${{ hashFiles('Cargo.lock') }}
# Python setup
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: x64
args: --release --out dist --manifest-path python/Cargo.toml --interpreter python${{ matrix.python-version }}
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
linux-release:
needs: [tag-release]
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
target: [x86_64, aarch64]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
# Cargo setup
- name: Set up Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('Cargo.lock') }}
# Python setup
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
args: --release --out dist --manifest-path python/Cargo.toml --interpreter python${{ matrix.python-version }}
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
linux-musl-release:
needs: [tag-release]
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
target: [x86_64-unknown-linux-musl, aarch64-unknown-linux-musl]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
# Cargo setup
- name: Set up Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('Cargo.lock') }}
# Python setup
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: musllinux_1_2
args: --release --out dist --manifest-path python/Cargo.toml --interpreter python${{ matrix.python-version }}
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
publish-py:
runs-on: ubuntu-latest
needs:
[
tag-release,
macos-release,
windows-release,
linux-release,
linux-musl-release,
]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
# Install publish dependencies
- name: Install publish dependencies
run: python -m pip install --upgrade twine
- name: Publish to PyPI
id: publish-to-pypi
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: twine upload *
- name: Upload to release
uses: actions/upload-artifact@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: wheels
path: "*"
upload_url: ${{ needs.tag-release.outputs.upload_url }}
publish-rs:
runs-on: ubuntu-latest
needs:
[
tag-release,
macos-release,
windows-release,
linux-release,
linux-musl-release,
]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
# Cargo setup
- name: Set up Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Publish dbn-macros to crates.io
run: cargo publish --token ${CARGO_REGISTRY_TOKEN} --package dbn-macros
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish dbn to crates.io
run: cargo publish --token ${CARGO_REGISTRY_TOKEN} --package dbn
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish dbn-cli to crates.io
run: cargo publish --token ${CARGO_REGISTRY_TOKEN} --package dbn-cli
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}