Skip to content

Commit

Permalink
new release process using an action (and docs to go with it)
Browse files Browse the repository at this point in the history
  • Loading branch information
shnewto committed Nov 12, 2023
1 parent e3661e2 commit 7d1e6a9
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
47 changes: 47 additions & 0 deletions .github/workflows/tag-and-publish-crate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: tag and publish crate [manual]

on:
workflow_dispatch:
inputs:
tag-increment:
default: patch
required: true
type: choice
options:
- patch
- minor
- major

jobs:
publish:
runs-on: macos-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- name: checkout repo
uses: actions/checkout@v2
- name: install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: install rustfmt
run: rustup component add rustfmt
- name: rustfmt check
run: cargo fmt --all -- --check
- name: install clippy
run: rustup component add clippy
- name: cargo clippy
run: cargo clippy --all-features --all-targets
- name: cargo test
run: cargo test
- name: install cargo bump
run: cargo install cargo-bump
- name: bump version
run: cargo bump -g ${{ inputs.tag-increment }}
- name: push
run: git push && git push --tags
- name: cargo publish
run: cargo publish --token ${{ secrets.CRATES_TOKEN }}
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ttaw"
description = "talking to a wall, a piecemeal natural language processing library"

# don't manually edit this version unless you're sure you want to circumvent the process documented in RELEASE.md
version = "0.3.0"
license = "MIT"

Expand Down
22 changes: 22 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Release Process

- leave the Cargo.toml package version alone :)
- trigger the `tag and publish crate [manual]` action and specify the release increment (major, minor, or patch)
- once the action completes, the Cargo.toml will be updated and the crate will be live on crates.io
- create a release (with title, notes, thanks, etc) and tie it to the tag that was created by the action / new crate version

## Execution

The order of operations for tagging and publishing in the action is this

1. run all checks, i.e. fmt, clippy, tests, etc
1. push change / update to the Cargo.toml
1. push the new tag to the repo
1. publish the new version to crates.io

## Troubleshooting

- if step 1 of execution fails, after addressing the error, you run the action again
- if step 2 of execution fails, after addressing the error, you run the action again
- if step 3 of execution fails (the Cargo.toml version was incremented), after addressing the error, you should manually tag (github's ux or the cli) and manually publish the crate with `cargo publish`
- if step 4 of execution fails (the Cargo.toml version was incremented and there's a new corresponding tag), after addressing the error, you should manually publish the crate with `cargo publish`

0 comments on commit 7d1e6a9

Please sign in to comment.