Publish #5
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: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| publish-fetchkit: | |
| name: Publish fetchkit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Verify version matches tag | |
| run: | | |
| TAG_VERSION="${{ github.event.release.tag_name }}" | |
| if [ -n "$TAG_VERSION" ]; then | |
| TAG_VERSION="${TAG_VERSION#v}" | |
| CARGO_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') | |
| if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then | |
| echo "Error: Tag version ($TAG_VERSION) does not match Cargo.toml version ($CARGO_VERSION)" | |
| exit 1 | |
| fi | |
| echo "Version verified: $TAG_VERSION" | |
| else | |
| echo "Manual dispatch - skipping tag verification" | |
| fi | |
| - name: Publish fetchkit to crates.io | |
| run: cargo publish -p fetchkit | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| publish-fetchkit-cli: | |
| name: Publish fetchkit-cli | |
| runs-on: ubuntu-latest | |
| needs: publish-fetchkit | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Wait for crates.io index update | |
| run: sleep 30 | |
| - name: Publish fetchkit-cli to crates.io | |
| run: cargo publish -p fetchkit-cli | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |