Publish to crates.io #2
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 to crates.io | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: 'Dry run only (no publish)' | |
| required: false | |
| default: true | |
| type: boolean | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| publish: | |
| name: Publish | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| working-directory: ./ProcessGhosting | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: ProcessGhosting | |
| - name: Get version | |
| id: version | |
| shell: bash | |
| run: | | |
| VERSION=$(cargo pkgid | sed 's/.*#//') | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Publishing version: $VERSION" | |
| - name: Verify package | |
| run: | | |
| cargo package --list | |
| cargo package | |
| - name: Dry run | |
| if: ${{ inputs.dry_run }} | |
| run: cargo publish --dry-run | |
| - name: Publish to crates.io | |
| if: ${{ !inputs.dry_run }} | |
| run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} | |
| env: | |
| CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
| - name: Summary | |
| run: | | |
| echo "## Publish Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Version**: ${{ steps.version.outputs.VERSION }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Dry Run**: ${{ inputs.dry_run }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Crate**: [ProcessGhosting](https://crates.io/crates/ProcessGhosting)" >> $GITHUB_STEP_SUMMARY |