From b565aa5f71a850a8d302b16d31cf60379508ff64 Mon Sep 17 00:00:00 2001 From: Martin Kunz Date: Tue, 25 Oct 2022 20:06:09 +0200 Subject: [PATCH] Add(CI): For automatically publishing on new versions (#70) * Add(CI): For automatically publishing on new versions * Fix(CI): added on push to main * Fix(CI): Add publish job * add(CI): semver check * edit(CI): Name Also checks semver so added that to the workflow name. --- .github/workflows/crates-publish.yml | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/crates-publish.yml diff --git a/.github/workflows/crates-publish.yml b/.github/workflows/crates-publish.yml new file mode 100644 index 00000000..fb487f59 --- /dev/null +++ b/.github/workflows/crates-publish.yml @@ -0,0 +1,34 @@ +on: + release: + types: [published, edited] + +name: Check SemVer compliance and publish on release + +jobs: + prepare: + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2022-08-03 + override: true + + semver: + runs-on: ubuntu-latest + steps: + - uses: actions-rs/cargo@v1 + with: + command: install + args: --git https://github.com/rust-lang/rust-semverver + - run: eval "current_version=$(grep -e '^version = .*$' Cargo.toml | cut -d ' ' -f 3)" + - run: cargo semver | tee semver_out + - run: (head -n 1 semver_out | grep "\-> $current_version") || (echo "versioning mismatch" && return 1) + + publish: + steps: + - uses: katyo/publish-crates@v1 + with: + dry-run: true + check-repo: ${{ github.event_name == 'push' }} + registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} + ignore-unpublished-changes: true