Skip to content

Release SDK for Mamoru WIT Agent #6

Release SDK for Mamoru WIT Agent

Release SDK for Mamoru WIT Agent #6

Workflow file for this run

name: "Release SDK for Mamoru WIT Agent"
on:
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
run: cargo test --verbose
- name: Build the project
run: cargo build --release
- name: Extract Version from Cargo.toml
id: extract_version
run: |
version=$(grep -m 1 '^version' Cargo.toml | awk -F\" '{print $2}')
echo "VERSION=$version" >> $GITHUB_ENV
- name: Validate inputs
run: |
if [[ "${{ env.VERSION }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "OK";
else
echo "Invalid tag format. Given: ${{ env.VERSION }}";
exit 1;
fi
- name: Create Git Tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "GitHub Actions"
git config user.email [email protected]
git tag -a ${{ env.VERSION }} -m "Release ${{ env.VERSION }}"
git push origin ${{ env.VERSION }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
tag_name: "v${{ env.VERSION }}"
name: "Release v${{ env.VERSION }}"
files: |
target/release/libmamoru_rust_sdk.so
- name: Publish to crates.io
uses: katyo/publish-crates@v2
if: startsWith(github.ref, 'refs/tags/')
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
dry-run: true