From ae672df1b74b7e844f2f0a0f9390593843825597 Mon Sep 17 00:00:00 2001 From: gsilvestrin Date: Wed, 14 Jun 2023 11:01:22 -0700 Subject: [PATCH] feat(rust): add action to publish release to crates.io (#192) --- .github/workflows/cargo-publish.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/pypi-publish.yml | 4 ++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/cargo-publish.yml diff --git a/.github/workflows/cargo-publish.yml b/.github/workflows/cargo-publish.yml new file mode 100644 index 00000000..47adacd7 --- /dev/null +++ b/.github/workflows/cargo-publish.yml @@ -0,0 +1,29 @@ +name: Cargo Publish + +on: + release: + types: [ published ] + +env: + # This env var is used by Swatinem/rust-cache@v2 for the cache + # key, so we set it to make sure it is always consistent. + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-22.04 + timeout-minutes: 30 + # Only runs on tags that matches the make-release action + if: startsWith(github.ref, 'refs/tags/v') + steps: + - uses: actions/checkout@v3 + - uses: Swatinem/rust-cache@v2 + with: + workspaces: rust + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y protobuf-compiler libssl-dev + - name: Publish the package + run: | + cargo publish -p vectordb --all-features --token ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 9b43d88c..6749e63c 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -3,12 +3,12 @@ name: PyPI Publish on: release: types: [ published ] - tags: - - 'python-v*' # Push events that matches the python-make-release action jobs: publish: runs-on: ubuntu-latest + # Only runs on tags that matches the python-make-release action + if: startsWith(github.ref, 'refs/tags/python-v') defaults: run: shell: bash