Skip to content

Publish

Publish #2

Workflow file for this run

name: Publish
on:
workflow_call:
workflow_dispatch:
jobs:
check-secret-existence:
runs-on: ubuntu-latest
steps:
- name: Get secret
id: secret
run: |
token=${{ secrets.CARGO_REGISTRY_TOKEN != '' }};
echo "token_exists=$token" >> "$GITHUB_OUTPUT";
- name: print if skip publish-crate
if: ${{ steps.secret.outputs.token_exists == 'false' }}
run: |
echo "add secrets.CARGO_REGISTRY_TOKEN to your github repo";
outputs:
secret_exists: ${{ steps.secret.outputs.token_exists }}
publish-crate:
needs: [check-secret-existence]
if: ${{ needs.check-secret-existence.outputs.secret_exists == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Fetch Repository
uses: actions/checkout@v4
- run: git pull
- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Cargo Publish
uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
ignore-unpublished-changes: true