Merge pull request #238 from maxcountryman/feature/gh-action-releases

automate crate publishing
This commit is contained in:
Max Countryman 2020-08-12 07:04:38 -07:00 committed by GitHub
commit 118a345790
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 0 deletions

View file

@ -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 }}

View file

@ -34,3 +34,6 @@ serde_json = { version = "1.0", optional = true }
[dev-dependencies]
simple_logger = "1.6"
matches = "0.1"
[package.metadata.release]
disable-publish = true

37
docs/releasing.md Normal file
View file

@ -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:
```
$ 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`.)