Skip to content

Publish to crates.io #5

Publish to crates.io

Publish to crates.io #5

Workflow file for this run

name: Publish to crates.io
on:
workflow_run:
workflows: ["Continuous Integration"]
types:
- completed
jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check for changes in src directory
id: check_changes
run: |
if git diff --name-only ${{ github.event.workflow_run.head_commit.id }}^ ${{ github.event.workflow_run.head_commit.id }} | grep -q '^src/'; then
echo "changes_in_src=true" >> $GITHUB_ENV
else
echo "changes_in_src=false" >> $GITHUB_ENV
fi
- name: Publish to crates.io
if: env.changes_in_src == 'true'
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish