cosmos/ibc-proto-rs

ci: publish to crates.io on new releases

Closed this issue · 0 comments

To make the release process more fluid, it would be good to have a CI step, similar to the one adopted by tendermint-rs which automates publishing to crates.io when a new semver tag is published on main:

 name: Release

on:
  push:
    tags:
      - "v[0-9]+.[0-9]+.[0-9]+"             # Push events to matching v*, i.e. v0.26.0, v1.0.0
      - "v[0-9]+.[0-9]+.[0-9]+-pre.[0-9]+"  # e.g. v0.26.0-pre.1

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true
      - name: Publish crate
        run: |
          cargo publish --token ${{ secrets.CRATES_TOKEN }}

Besides adding this workflow, all that's needed is to add a github user to the crates.io permissions, generate a token and add it to the repository's SECRETs ("CRATES_TOKEN").

This means that doing chore release (e.g. tracking tendermint-rs versions) becomes much easier. It can be done via git tag -a v0.x.x or using the Github UI ("Create new release and create tag").