Publish Crates #17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Crates | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: ["v*"] | |
| workflow_run: | |
| workflows: ["Tag and Release"] | |
| types: | |
| - completed | |
| jobs: | |
| publish: | |
| name: Publish ndg-commonmark | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry and index | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Publish ndg-commonmark | |
| run: | | |
| if [ -z "${{ secrets.CARGO_REGISTRY_SECRET }}" ]; then | |
| echo "CARGO_REGISTRY_SECRET is not set. Skipping publish." | |
| exit 0 | |
| fi | |
| cargo publish -p ndg-commonmark \ | |
| --no-verify --locked --token ${{ secrets.CARGO_REGISTRY_SECRET }} | |
| - name: Wait for ndg-commonmark to be available | |
| run: | | |
| for i in {1..10}; do | |
| sleep 3 | |
| cargo search ndg-commonmark | grep -q ndg-commonmark && break | |
| done |