chore(release): v0.18.1 #51
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 to crates.io | |
| # Tag-driven release. Pushing a version tag `vX.Y.Z` (cut by release.yml on merge) runs this | |
| # workflow, which cuts a GitHub Release for the tag. | |
| # | |
| # crates.io publish is GUARDED OFF for now (#681). dig-gossip still resolves its DIG dependencies | |
| # (dig-protocol, dig-nat, dig-constants) from git, and `cargo publish` requires every non-dev | |
| # dependency to be a released crates.io version. Until the whole dependency tree is on crates.io | |
| # (#681), a tag-triggered `cargo package`/`cargo publish` verify re-resolves those bare-git deps to | |
| # their drifted `main` tips and fails to compile — cutting a spurious RED release run on every merge | |
| # even though the git+lock consumer path (dig-node builds dig-gossip via git + Cargo.lock) is fine. | |
| # So the crates.io steps run ONLY on a manual `workflow_dispatch`; a tag push just cuts the GitHub | |
| # Release. Flip this to per-tag once #681 has published the dependency tree to crates.io by version. | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to publish (e.g., v0.1.0)' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| # crates.io publish. GUARDED to `workflow_dispatch` only (#681): a tag push does NOT publish (the | |
| # git dependency tree is not yet on crates.io — see the header note). The job stays present so the | |
| # `create-release` job below can `needs:` it and still cut a GitHub Release on every tag. | |
| publish: | |
| name: Publish to crates.io | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Skip crates.io publish on tag push (#681) | |
| if: github.event_name != 'workflow_dispatch' | |
| run: | | |
| echo "Skipping crates.io publish: dig-gossip's DIG dependencies are not yet on crates.io (#681)." | |
| echo "The git + Cargo.lock consumer path (dig-node) is unaffected; the GitHub Release still cuts." | |
| - name: Checkout code | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| - name: Cache dependencies | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: Swatinem/rust-cache@v2 | |
| # `--locked` (not `--allow-dirty`): verify against the committed Cargo.lock so deps resolve to | |
| # their pinned revisions instead of re-resolving bare-git deps to a drifted `main` tip. | |
| - name: Verify package can be built | |
| if: github.event_name == 'workflow_dispatch' | |
| run: cargo build --release --locked | |
| - name: Verify package can be packaged | |
| if: github.event_name == 'workflow_dispatch' | |
| run: cargo package --locked | |
| - name: Check if CARGO_REGISTRY_TOKEN is available | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| if [ -z "${{ secrets.CARGO_REGISTRY_TOKEN }}" ]; then | |
| echo "CARGO_REGISTRY_TOKEN secret is not set in repository settings" | |
| exit 1 | |
| fi | |
| - name: Publish to crates.io | |
| if: github.event_name == 'workflow_dispatch' | |
| run: cargo publish --locked --token ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| create-release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: publish | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Extract version from tag | |
| id: extract_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: "dig-gossip v${{ steps.extract_version.outputs.VERSION }}" | |
| body: | | |
| ## dig-gossip v${{ steps.extract_version.outputs.VERSION }} | |
| DIG Network P2P gossip — peer discovery, connection management, and message routing with Plumtree, ERLAY, priority lanes, compact blocks, Dandelion++, and relay fallback. | |
| ### Installation | |
| ```toml | |
| [dependencies] | |
| dig-gossip = "${{ steps.extract_version.outputs.VERSION }}" | |
| ``` | |
| See the [README](https://github.com/DIG-Network/dig-gossip/blob/main/README.md) for usage instructions. | |
| draft: false | |
| prerelease: false |