Publish releases on crates.io
@@ -19,7 +19,8 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
- lints:
+
+ lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@@ -37,3 +38,42 @@ jobs:
with:
command: clippy
args: -- -D warnings
+
+ publish-check:
+ name: Publish Check
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v1
+ - uses: actions-rs/toolchain@v1
+ with:
+ toolchain: stable
+ override: true
+ - name: cargo fetch
+ uses: actions-rs/cargo@v1
+ with:
+ command: fetch
+ - name: cargo publish check
+ uses: actions-rs/cargo@v1
+ with:
+ command: publish
+ args: --dry-run
+
+ publish:
+ if: startsWith(github.ref, 'refs/tags/')
+ needs:
+ - test
+ - lint
+ - publish-check
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v1
+ - name: cargo fetch
+ uses: actions-rs/cargo@v1
+ with:
+ command: fetch
+ - name: cargo publish
+ uses: actions-rs/cargo@v1
+ env:
+ CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
+ with:
+ command: publish
