-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What would an auto-release workflow look like? #117
Comments
One approach I just came across via awesome-rust is semantic which uses clog to generate the changelog and determine the bump level based on the commit messages. |
Personally I prefer an isolation between commit log, which is dev-facing, and release notes, which is user facing. So I didn't included auto changelog generation from very beginning. However, I agree it's possible to determine the release level from commit log or public api changes. I wish semantic could offer a binary of library just for determining bump level so we can add optional support for that. |
Ideally, yes but I maintain too many crates to always worry about the changelog. Maybe switching to cargo-release will help. However, I do tend to make my commits more user focused (if they are feat/fix rather than refactor/chore). And too often I see projects, major projects, without them and I'm at a loss digging through commits when they make breaking changes. Something is better than nothing.
At my quick glance, it looked like semantic was just calling into |
The downside to Another approach is to instead have the source always represent what the next version will be. If a commit makes a breaking change, then that commit is responsible for updating the version number without doing a release. The CI then releases that version. To support this, we might want a The use cases we'd want to consider supporting
... I have more thoughts and there is some problem areas but I wanted to post this without a long delay as I write it all up |
we recently did this at my work and i figured it would be helpful to share since it was not straight forward to figure out. the workflow we have relies on two main actions, one to ensure that pr titles(and thus the merge commit) have a valid bump level and one that reads that commit and creates the tag and bumps everything. a MAJOR caveat with this is that adding those secrets makes them available for use by anyone opening a pr on your repo. if you google "push to protected branch github action", you will get a bunch of results like this: https://github.community/t/allowing-github-actions-bot-to-push-to-protected-branch/16536 . we are using this on a private repo, so we're not really concerned with someone doing some fishy. i think there must be ways to mitigate that since rust itself has something like this, but i haven't looked into it at all
|
For what it's worth, if you don't need signed commits or are worried about protected branches, you can get away with a much more out-of-the-box release process. name: Release
env:
CARGO_TERM_COLOR: always
defaults:
run:
shell: bash
on:
workflow_dispatch:
inputs:
level:
type: choice
description: Bump level
options:
- patch
- minor
- major
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: cache cargo cache
id: cache-release
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/target/
key: ${{ runner.os }}-cargo-release
- name: checkout code
uses: actions/checkout@v3
- name: git config
run: |
git config user.name "Github Actions: Release"
git config user.email "<>"
# fail early if tests fail
- name: run tests
run: |
make test
- name: install cargo-release
uses: actions-rs/cargo@v1
if: steps.cache-release.outputs.cache-hit != 'true'
with:
command: install
args: cargo-release
- name: cargo release ${{ github.event.inputs.level }}
uses: actions-rs/cargo@v1
with:
command: release
args: ${{ github.event.inputs.level }} --execute --no-confirm --config .github/workflows/cargo-release.toml |
With 0.22 out, we now have While this isn't fully automatic, this gets as close as I think is safe at this point. |
I've started building a tool that I called
I was envisioning the following integration with
What do you think of this idea? |
I can't fully articulate why but that handshake doesn't feel quite right to me. |
Do you see any possible integration that would compute the bump level dynamically? |
Something I've been considering is the idea of auto-releasing after each PR but the question is "how?"
The text was updated successfully, but these errors were encountered: