From b9cbeb1dbf33fff6c7b03ef24f0e6a773f58da82 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Sun, 25 May 2025 03:05:21 +0800 Subject: feat: Add GitHub Actions workflow for publishing to crates.io --- .github/workflows/publish-crates.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/publish-crates.yml (limited to '.github') diff --git a/.github/workflows/publish-crates.yml b/.github/workflows/publish-crates.yml new file mode 100644 index 0000000..96f1007 --- /dev/null +++ b/.github/workflows/publish-crates.yml @@ -0,0 +1,35 @@ +name: Publish to crates.io +on: + push: + branches: + - main + - master + tags: + - '*' + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + publish: + name: Publish crate + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: Publish to crates.io + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + run: | + cargo publish --no-verify -- cgit v1.2.3-70-g09d2