From 26143ad733009044c7924cd8097c389ee9cced46 Mon Sep 17 00:00:00 2001 From: Joel Wachsler Date: Sun, 10 Jul 2022 18:09:08 +0000 Subject: [PATCH] Add version verification --- .github/verify_version.sh | 12 ++++++++++++ .github/workflows/release.yml | 10 ++++++---- Cargo.lock | 2 +- Cargo.toml | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) create mode 100755 .github/verify_version.sh diff --git a/.github/verify_version.sh b/.github/verify_version.sh new file mode 100755 index 0000000..7524635 --- /dev/null +++ b/.github/verify_version.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e + +QBITTORRENT_WEB_API_VERSION="$(cat Cargo.toml | grep version | head -1 | sed 's/version = //' | sed 's/"//g')" +QBITTORRENT_WEB_API_GEN_VERSION="$(cat qbittorrent-web-api-gen/Cargo.toml | grep version | head -1 | sed 's/version = //' | sed 's/"//g')" + +if [ $QBITTORRENT_WEB_API_VERSION != $QBITTORRENT_WEB_API_GEN_VERSION ] +then + printf "Version mismatch, QBITTORRENT_WEB_API_VERSION=${QBITTORRENT_WEB_API_VERSION} and QBITTORRENT_WEB_API_GEN_VERSION=${QBITTORRENT_WEB_API_GEN_VERSION} (they must match)" >&2 + exit 1 +fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f341c51..97a4586 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,11 +7,17 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 + + - name: Verify version + run: ./.github/verify_version.sh + - name: Install latest stable uses: actions-rs/toolchain@v1 with: toolchain: stable + - name: Extract + - name: Login uses: actions-rs/cargo@v1 with: @@ -29,8 +35,4 @@ jobs: with: command: publish - # - name: Publish qbittorrent-web-api - # uses: actions-rs/cargo@v1 - # with: - # command: publish \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 879a9ad..71f8de0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -545,7 +545,7 @@ dependencies = [ [[package]] name = "qbittorrent-web-api" -version = "0.1.0" +version = "0.2.0" dependencies = [ "qbittorrent-web-api-gen", "reqwest", diff --git a/Cargo.toml b/Cargo.toml index 097b668..f311298 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "qbittorrent-web-api" -version = "0.1.0" +version = "0.2.0" edition = "2021" license-file = "LICENSE" keywords = ["qbittorrent"]