Skip to content

automate crate publishing #238

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

Merged
merged 4 commits into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,16 @@ jobs:
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

publish-crate:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Set up Rust
uses: hecrj/setup-rust-action@v1
- uses: actions/checkout@v2
- name: Publish
shell: bash
run: |
cargo publish --token ${{ secrets.CRATES_TOKEN }}
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ serde_json = { version = "1.0", optional = true }
[dev-dependencies]
simple_logger = "1.0.1"
matches = "0.1"

[package.metadata.release]
disable-publish = true
37 changes: 37 additions & 0 deletions docs/releasing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Releasing

Releasing, i.e. crate publishing, has been automated via GitHub Actions.

We use the [`cargo release`](https://github.com/sunng87/cargo-release)
subcommand to ensure correct versioning. Install via:

```
$ cargo install cargo-release
```

**Before releasing** ensure `CHANGELOG.md` is updated appropriately.

## Process

Using `cargo-release` we can author a new minor release like so:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not thinking of the new releases as "minor", so perhaps it would be useful to remind that this means 0.(N+1) in our context?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure that makes sense to me. Maybe we should simply link to the CHANGELOG where that's described?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but CHANGELOG doesn't mention "minor" releases either. Technically, "minor" is the correct term with regards to semver, but in context of sqlparser using it without mentioning semver is slightly weird. Do what you think is best, I don't have a strong opinion on if or how this should be addressed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave this as-is for now.


```
$ cargo release minor --skip-publish
```

**Ensure publishing is skipped** since pushing the resulting tag upstream will
handle crate publishing automatically.

This will create a new tag, `0.6.0` with the message,
`(cargo-release) sqlparser version 0.6.0`.

Once the tag is created, pushing the tag upstream will trigger a publishing
process to crates.io. Now to push our example tag:

```
git push origin 0.6.0
```

(Note that this process is fully automated; credentials
for authoring in this way are securely stored in the repo secrets as
`CRATE_TOKEN`.)