Chebyshev scalarization + evolution-as-inference explorable (0.3.1) (… #9
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 | |
| # The workspace declares fugue-ppl as a path dependency, so cargo needs | |
| # the sibling checkout even to read metadata. The published crate itself | |
| # resolves fugue-ppl from crates.io by version (the path key is stripped | |
| # at packaging time), so main is always the right branch here. | |
| - name: Checkout sibling fugue (path dependency) | |
| run: git clone --depth 1 --branch main https://github.com/alexnodeland/fugue.git "$GITHUB_WORKSPACE/../fugue" | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Check if version is already published | |
| id: version_check | |
| run: | | |
| PACKAGE_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "fugue-evo") | .version') | |
| echo "Checking if fugue-evo 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 -p fugue-evo 2>&1) | |
| if echo "$DRY_RUN_OUTPUT" | grep -q "already exists on crates.io index"; then | |
| echo "Version $PACKAGE_VERSION of fugue-evo already exists on crates.io. Skipping publish." | |
| echo "should_publish=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Version $PACKAGE_VERSION of fugue-evo 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 -p fugue-evo | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |