Publish Python and Rust Packages #19
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: Publish Python and Rust Packages | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
id-token: write | |
concurrency: | |
group: "publish" | |
cancel-in-progress: true | |
jobs: | |
publish-python: | |
timeout-minutes: 10 | |
name: Build and publish Python package | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libudev-dev pkg-config | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build wheel | |
- name: Build package | |
run: python -m build --sdist --outdir dist/ . | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
publish-rust: | |
timeout-minutes: 10 | |
name: Build and publish Rust package | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libudev-dev pkg-config | |
- name: Cache Cargo registry | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry | |
restore-keys: | | |
${{ runner.os }}-cargo-registry | |
- name: Cache Cargo index | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/git | |
key: ${{ runner.os }}-cargo-index | |
restore-keys: | | |
${{ runner.os }}-cargo-index | |
- name: Publish Robstride package to crates.io | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: | | |
cd actuator/robstride | |
cargo publish |