From 3209874fa9dd4fedc2bf60cf7a3590233fe1a038 Mon Sep 17 00:00:00 2001 From: Raul Victor Trombin Date: Thu, 13 Jul 2023 23:42:41 -0300 Subject: [PATCH] github: workflows: Add automatic crates.io deploy action --- .github/workflows/action.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 3d7ea875a6..fc9330fb7d 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -40,3 +40,29 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./target/doc + + deploy: + needs: build + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Checkout to repository + uses: actions/checkout@v2 + - name: Setup Rust toolchain + uses: actions-rs/toolchain@v1.0.7 + with: + toolchain: stable + override: true + - name: Install cargo-bump + run: cargo install cargo-bump --force + - name: Modify version with tag + run: cargo bump ${{ github.ref_name }} + - name: Automatic commit for crate version upgrade + uses: stefanzweifel/git-auto-commit-action@v4 + with: + branch: master + commit_message: "Cargo: Update the crate version to ${{ github.ref_name }}" + - name: Publish to crates.io + uses: katyo/publish-crates@v1 + with: + registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}