diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1e6fbca..d66b42e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,49 +1,11 @@ name: Continuous Integration -on: [push, pull_request] +on: + push: + branches: + - "*" + pull_request: jobs: - test: - name: Test Suite - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Run cargo test - uses: actions-rs/cargo@v1 - with: - command: test - args: --workspace --all-targets - - lints: - name: Lints - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Run cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - name: Run cargo clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --workspace --all-targets -- -D warnings - - publish: - name: Publish to crates.io - if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v') - needs: [test, lints] - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Run cargo publish - uses: actions-rs/cargo@v1 - with: - command: publish - env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CratesIoToken }} - + lints-and-tests: + uses: rob2309/workflows/.github/workflows/rust-code-check.yaml@master diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..26f2ad7 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,35 @@ +name: Publish on crates.io + +on: + workflow_dispatch: + push: + tags: + - v* + +jobs: + tests-and-lints: + uses: rob2309/workflows/.github/workflows/rust-code-check.yaml@master + + publish: + name: Publish to crates.io + needs: [tests-and-lints] + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Check version consistency + uses: rob2309/workflows/.github/actions/check-crate-version@master + - name: Create GitHub Release + uses: actions/create-release@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: true + - name: Run cargo publish + uses: actions-rs/cargo@v1 + with: + command: publish + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CratesIoToken }}