Skip to content

Commit

Permalink
publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
codekansas committed Oct 31, 2024
1 parent b5d5c66 commit cd75725
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
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
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build wheel
- name: Build package
run: python -m build --sdist --wheel --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

0 comments on commit cd75725

Please sign in to comment.