build: drive cargo releases from git tag (#610)

Follow-up to f7d297f98f.

Update the release workflows for the dependent crates. The Cargo
workflows run on GitHub release publish to match the Python package
release workflow. This means all of our crates are versioned in lockstep
by the Git tag.

There are four changes:

1. Trigger the workflows on GitHub release publish
2. Add the `set version` step from `release.yml` to modify the version
tags in `Cargo.toml`.
3. Publish with `--allow-dirty` (to account for the edit in step 2)
4. In `extism-maturin`, do not inherit `authors` from the workspace
since [PyPI rejects the value we have
set](https://github.com/extism/extism/actions/runs/7012534645/job/19077216730#step:7:23).
This commit is contained in:
Chris Dickinson
2023-11-27 17:28:56 -08:00
committed by GitHub
parent e75dd05c6c
commit 06706f07be
4 changed files with 57 additions and 4 deletions

View File

@@ -1,4 +1,6 @@
on: on:
release:
types: [published, edited]
workflow_dispatch: workflow_dispatch:
name: Release extism-convert name: Release extism-convert
@@ -10,6 +12,21 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
ref: '${{ github.ref }}'
- name: Set version
shell: bash
run: |
version="${{ github.ref }}"
if [[ "$version" = "refs/heads/main" ]]; then
version="0.0.0-dev"
else
version="${version/refs\/tags\/v/}"
fi
sed -i -e "s/0.0.0+replaced-by-ci/${version}/g" Cargo.toml
pyproject="$(cat extism-maturin/pyproject.toml)"
<<<"$pyproject" >extism-maturin/pyproject.toml sed -e 's/^version = "0.0.0.replaced-by-ci"/version = "'"$version"'"/g'
- name: Setup Rust env - name: Setup Rust env
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
@@ -23,4 +40,4 @@ jobs:
env: env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_TOKEN }} CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_TOKEN }}
run: | run: |
cargo publish --manifest-path convert/Cargo.toml cargo publish --manifest-path convert/Cargo.toml --allow-dirty

View File

@@ -1,4 +1,6 @@
on: on:
release:
types: [published, edited]
workflow_dispatch: workflow_dispatch:
name: Release extism-manifest name: Release extism-manifest
@@ -10,6 +12,21 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
ref: '${{ github.ref }}'
- name: Set version
shell: bash
run: |
version="${{ github.ref }}"
if [[ "$version" = "refs/heads/main" ]]; then
version="0.0.0-dev"
else
version="${version/refs\/tags\/v/}"
fi
sed -i -e "s/0.0.0+replaced-by-ci/${version}/g" Cargo.toml
pyproject="$(cat extism-maturin/pyproject.toml)"
<<<"$pyproject" >extism-maturin/pyproject.toml sed -e 's/^version = "0.0.0.replaced-by-ci"/version = "'"$version"'"/g'
- name: Setup Rust env - name: Setup Rust env
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
@@ -23,4 +40,4 @@ jobs:
env: env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_TOKEN }} CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_TOKEN }}
run: | run: |
cargo publish --manifest-path manifest/Cargo.toml cargo publish --manifest-path manifest/Cargo.toml --allow-dirty

View File

@@ -1,4 +1,6 @@
on: on:
release:
types: [published, edited]
workflow_dispatch: workflow_dispatch:
name: Release Runtime/Rust SDK name: Release Runtime/Rust SDK
@@ -10,6 +12,21 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
ref: '${{ github.ref }}'
- name: Set version
shell: bash
run: |
version="${{ github.ref }}"
if [[ "$version" = "refs/heads/main" ]]; then
version="0.0.0-dev"
else
version="${version/refs\/tags\/v/}"
fi
sed -i -e "s/0.0.0+replaced-by-ci/${version}/g" Cargo.toml
pyproject="$(cat extism-maturin/pyproject.toml)"
<<<"$pyproject" >extism-maturin/pyproject.toml sed -e 's/^version = "0.0.0.replaced-by-ci"/version = "'"$version"'"/g'
- name: Setup Rust env - name: Setup Rust env
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
@@ -23,4 +40,4 @@ jobs:
env: env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_TOKEN }} CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_TOKEN }}
run: | run: |
cargo publish --manifest-path runtime/Cargo.toml cargo publish --manifest-path runtime/Cargo.toml --allow-dirty

View File

@@ -1,11 +1,13 @@
[package] [package]
name = "extism-sys" name = "extism-sys"
edition.workspace = true edition.workspace = true
authors.workspace = true
license.workspace = true license.workspace = true
homepage.workspace = true homepage.workspace = true
repository.workspace = true repository.workspace = true
version.workspace = true version.workspace = true
# Explicitly omit authors from this package since our Cargo "authors" are
# incompatible with PyPI's requirements.
# authors.workspace = true
[lib] [lib]
name = "extism_sys" name = "extism_sys"