Publish #6
Workflow file for this run
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: | |
| inputs: | |
| release_tag: | |
| description: "Release tag to publish (e.g. v0.2.0)" | |
| required: true | |
| type: string | |
| permissions: | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| publish-fetchkit: | |
| name: Publish fetchkit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.event.release.tag_name }} | |
| - name: Install Rust stable | |
| run: | | |
| rustup toolchain install stable --profile minimal | |
| rustup default stable | |
| - name: Verify version matches tag | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| INPUT_RELEASE_TAG: ${{ inputs.release_tag }} | |
| RELEASE_TAG_NAME: ${{ github.event.release.tag_name }} | |
| run: | | |
| if [ "$EVENT_NAME" = "workflow_dispatch" ]; then | |
| TAG_VERSION="$INPUT_RELEASE_TAG" | |
| else | |
| TAG_VERSION="$RELEASE_TAG_NAME" | |
| fi | |
| if [ -z "$TAG_VERSION" ]; then | |
| echo "Error: release tag is required" | |
| exit 1 | |
| fi | |
| 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" | |
| - 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.event.release.tag_name }} | |
| - name: Install Rust stable | |
| run: | | |
| rustup toolchain install stable --profile minimal | |
| rustup default 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 }} |