docs: Fugue Explorables — interactive, data-first documentation rehau… #18
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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - v[0-9]+.[0-9]+.[0-9]+ | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Check if version is already published | |
| id: version_check | |
| run: | | |
| # Get the workspace package info (not dependencies) | |
| WORKSPACE_ROOT=$(cargo metadata --format-version=1 | jq -r '.workspace_root') | |
| PACKAGE_NAME=$(cargo metadata --format-version=1 | jq -r --arg root "$WORKSPACE_ROOT" '.packages[] | select(.manifest_path | startswith($root)) | .name') | |
| PACKAGE_VERSION=$(cargo metadata --format-version=1 | jq -r --arg root "$WORKSPACE_ROOT" '.packages[] | select(.manifest_path | startswith($root)) | .version') | |
| echo "Checking if $PACKAGE_NAME version $PACKAGE_VERSION can be published..." | |
| # Use cargo publish --dry-run to check if we can publish this version | |
| # This is the most reliable method as it uses the same logic as actual publish | |
| DRY_RUN_OUTPUT=$(cargo publish --dry-run --allow-dirty 2>&1) | |
| if echo "$DRY_RUN_OUTPUT" | grep -q "already exists on crates.io index"; then | |
| echo "Version $PACKAGE_VERSION of $PACKAGE_NAME already exists on crates.io. Skipping publish." | |
| echo "should_publish=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Version $PACKAGE_VERSION of $PACKAGE_NAME can be published. Proceeding with publish." | |
| echo "should_publish=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Publish to crates.io | |
| if: steps.version_check.outputs.should_publish == 'true' | |
| run: cargo publish --allow-dirty | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |