From f6a73c0a89c12fc27dc04165fce912a9f21cfac3 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Wed, 10 Apr 2024 14:11:40 +0200 Subject: [PATCH 1/9] feat: Add bump.bash script --- ci/scripts/bump.bash | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 ci/scripts/bump.bash diff --git a/ci/scripts/bump.bash b/ci/scripts/bump.bash new file mode 100644 index 000000000..c2b90cc64 --- /dev/null +++ b/ci/scripts/bump.bash @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# Project version +readonly VERSION +# Zenoh dependencies' version +readonly ZENOH_VERSION +# Zenoh dependencies' git branch +readonly ZENOH_BRANCH + +cargo +stable install toml-cli + +# NOTE(fuzzypixelz): toml-cli doesn't yet support in-place modification +# See: https://github.com/gnprice/toml-cli?tab=readme-ov-file#writing-ish-toml-set +function toml_set_in_place() { + local tmp=$(mktemp) + toml set "$1" "$2" "$3" > "$tmp" + mv "$tmp" "$1" +} + +# Bump CMake project version +sed -i "s;^set(ZENOHC_VERSION .*)$;set(ZENOHC_VERSION $VERSION);" CMakeLists.txt +# Propagate version change to Cargo.toml and Cargo.toml.in +cmake . -DZENOHC_BUILD_IN_SOURCE_TREE=TRUE -DCMAKE_BUILD_TYPE=Release + +git commit CMakeLists.txt Cargo.toml Cargo.lock -m "chore: Bump version to $VERSION" + +# Select all package dependencies that match 'zenoh.*' and bump them to $ZENOH_VERSION +zenoh_deps=$(toml get Cargo.toml dependencies | jq -r 'keys.[] | select(test("zenoh.*"))') +for dep in $zenoh_deps; do + [[ -n $ZENOH_VERSION ]] && toml_set_in_place Cargo.toml "dependencies.$dep.version" "$ZENOH_VERSION" + [[ -n $ZENOH_BRANCH ]] && toml_set_in_place Cargo.toml "dependencies.$dep.branch" "$ZENOH_BRANCH" +done +# Update lockfile +cargo check + +if [[ -n $ZENOH_VERSION || -n $ZENOH_BRANCH ]]; then + git commit Cargo.toml Cargo.lock -m "chore: Bump Zenoh version to $ZENOH_VERSION" +else + echo "info: no changes have been made to Zenoh dependencies" +fi From afd74cc536b8e1b5f3f1b15364a6581465db6b94 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Wed, 10 Apr 2024 14:24:48 +0200 Subject: [PATCH 2/9] feat: Support `x.y.z` project version numbers --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d236e99fe..35728830d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,10 +36,10 @@ declare_cache_var(ZENOHC_LIB_STATIC FALSE BOOL "Alias zenohc::lib target to zeno # set(project_version "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") if(NOT PROJECT_VERSION_TWEAK) + set(project_version "${project_version}") +elseif(PROJECT_VERSION_TWEAK EQUAL 0) set(project_version "${project_version}-dev") -elseif(PROJECT_VERSION_TWEAK EQUAL 1) - set(project_version "${project_version}-rc") -elseif(PROJECT_VERSION_TWEAK LESS 255) +elseif(PROJECT_VERSION_TWEAK GREATER 1) set(project_version "${project_version}-rc.${PROJECT_VERSION_TWEAK}") endif() status_print(project_version) From cb2c4e0d48c9fa9237cdfc147e38bc91d6655147 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Wed, 10 Apr 2024 14:34:47 +0200 Subject: [PATCH 3/9] fix: Remove enforce-linking-issues workflow --- .github/workflows/enforce-linking-issues.yml | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 .github/workflows/enforce-linking-issues.yml diff --git a/.github/workflows/enforce-linking-issues.yml b/.github/workflows/enforce-linking-issues.yml deleted file mode 100644 index ebeddd9ee..000000000 --- a/.github/workflows/enforce-linking-issues.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: Enforce linking issues - -on: - pull_request_target: - types: [opened, edited, labeled] - -jobs: - main: - uses: eclipse-zenoh/zenoh/.github/workflows/enforce-linking-issues.yml@main - secrets: inherit From 43b16343115654633c519f6acd7fdc185049e51d Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Wed, 10 Apr 2024 14:39:37 +0200 Subject: [PATCH 4/9] fix: Enable unbound variables --- ci/scripts/bump.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/scripts/bump.bash b/ci/scripts/bump.bash index c2b90cc64..9b39cb021 100644 --- a/ci/scripts/bump.bash +++ b/ci/scripts/bump.bash @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -euo pipefail +set -eo pipefail # Project version readonly VERSION From 64e6d174549b43d9fcac2c2642e345bb235fd4d2 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Wed, 10 Apr 2024 14:40:07 +0200 Subject: [PATCH 5/9] fix: Update Read the Docs version in bump.bash --- ci/scripts/bump.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/scripts/bump.bash b/ci/scripts/bump.bash index 9b39cb021..11fd44a2d 100644 --- a/ci/scripts/bump.bash +++ b/ci/scripts/bump.bash @@ -23,6 +23,8 @@ function toml_set_in_place() { sed -i "s;^set(ZENOHC_VERSION .*)$;set(ZENOHC_VERSION $VERSION);" CMakeLists.txt # Propagate version change to Cargo.toml and Cargo.toml.in cmake . -DZENOHC_BUILD_IN_SOURCE_TREE=TRUE -DCMAKE_BUILD_TYPE=Release +# Update Read the Docs version +sed -i "s;^release = .*$;release = '$VERSION';" docs/conf.py git commit CMakeLists.txt Cargo.toml Cargo.lock -m "chore: Bump version to $VERSION" From 355eda36ef9eff3142bf4a5fbfa4110f5f18abaa Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Wed, 10 Apr 2024 15:02:24 +0200 Subject: [PATCH 6/9] fix: Bump Debian self dependency version --- ci/scripts/bump.bash | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ci/scripts/bump.bash b/ci/scripts/bump.bash index 11fd44a2d..6b196021b 100644 --- a/ci/scripts/bump.bash +++ b/ci/scripts/bump.bash @@ -25,8 +25,11 @@ sed -i "s;^set(ZENOHC_VERSION .*)$;set(ZENOHC_VERSION $VERSION);" CMakeLists.txt cmake . -DZENOHC_BUILD_IN_SOURCE_TREE=TRUE -DCMAKE_BUILD_TYPE=Release # Update Read the Docs version sed -i "s;^release = .*$;release = '$VERSION';" docs/conf.py +# Update Debian dependency of libzenohc-dev +toml_set_in_place Cargo.toml "package.metadata.deb.variants.libzenohc-dev.depends" "libzenohc (=$VERSION)" +toml_set_in_place Cargo.toml.in "package.metadata.deb.variants.libzenohc-dev.depends" "libzenohc (=$VERSION)" -git commit CMakeLists.txt Cargo.toml Cargo.lock -m "chore: Bump version to $VERSION" +git commit CMakeLists.txt Cargo.toml Cargo.toml.in Cargo.lock -m "chore: Bump version to $VERSION" # Select all package dependencies that match 'zenoh.*' and bump them to $ZENOH_VERSION zenoh_deps=$(toml get Cargo.toml dependencies | jq -r 'keys.[] | select(test("zenoh.*"))') From 3627c822678e32684af578c7148d992cf2df9ad8 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Wed, 10 Apr 2024 15:03:24 +0200 Subject: [PATCH 7/9] fix: Bump Zenoh dependencies in Cargo.toml.in --- ci/scripts/bump.bash | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ci/scripts/bump.bash b/ci/scripts/bump.bash index 6b196021b..e77d3ae1c 100644 --- a/ci/scripts/bump.bash +++ b/ci/scripts/bump.bash @@ -34,14 +34,21 @@ git commit CMakeLists.txt Cargo.toml Cargo.toml.in Cargo.lock -m "chore: Bump ve # Select all package dependencies that match 'zenoh.*' and bump them to $ZENOH_VERSION zenoh_deps=$(toml get Cargo.toml dependencies | jq -r 'keys.[] | select(test("zenoh.*"))') for dep in $zenoh_deps; do - [[ -n $ZENOH_VERSION ]] && toml_set_in_place Cargo.toml "dependencies.$dep.version" "$ZENOH_VERSION" - [[ -n $ZENOH_BRANCH ]] && toml_set_in_place Cargo.toml "dependencies.$dep.branch" "$ZENOH_BRANCH" + if [[ -n $ZENOH_VERSION ]]; then + toml_set_in_place Cargo.toml "dependencies.$dep.version" "$ZENOH_VERSION" + toml_set_in_place Cargo.toml.in "dependencies.$dep.version" "$ZENOH_VERSION" + fi + + if [[ -n $ZENOH_BRANCH ]]; then + toml_set_in_place Cargo.toml "dependencies.$dep.branch" "$ZENOH_BRANCH" + toml_set_in_place Cargo.toml.in "dependencies.$dep.branch" "$ZENOH_BRANCH" + fi done # Update lockfile cargo check if [[ -n $ZENOH_VERSION || -n $ZENOH_BRANCH ]]; then - git commit Cargo.toml Cargo.lock -m "chore: Bump Zenoh version to $ZENOH_VERSION" + git commit Cargo.toml Cargo.toml.in Cargo.lock -m "chore: Bump Zenoh version to $ZENOH_VERSION" else echo "info: no changes have been made to Zenoh dependencies" fi From 038edf4ca0678be961eb61cd522fca0d72f56160 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Wed, 10 Apr 2024 15:08:14 +0200 Subject: [PATCH 8/9] fix: Simplify project version matching in CMakeLists.txt --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 35728830d..58af3aca4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,12 @@ cmake_minimum_required(VERSION 3.16) + +# NOTE(fuzzpixelz): The ci/scripts/bump.bash scripts sets the project version +# using regular expressions on this statement. +set(ZENOHC_VERSION 0.11.0.0) + project( zenohc - VERSION 0.11.0.0 + VERSION ${ZENOHC_VERSION} DESCRIPTION "The C bindings for Zenoh" HOMEPAGE_URL "https://github.com/eclipse-zenoh/zenoh-c" LANGUAGES C From 6400eb6995bf7a9426dc221184497bca81439470 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Wed, 10 Apr 2024 17:20:50 +0200 Subject: [PATCH 9/9] feat: Automate Release workflow --- .github/workflows/release.yml | 346 ++++++++++++---------------------- ci/scripts/bump.bash | 59 ++++-- 2 files changed, 164 insertions(+), 241 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 40d2cdb45..9451f6465 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,237 +14,135 @@ name: Release on: - release: - types: [published] schedule: - - cron: "0 1 * * 1-5" + - cron: "0 0 * * 1-5" workflow_dispatch: + inputs: + live-run: + type: boolean + description: Live-run + required: false + version: + type: string + description: Release number + required: false + zenoh-version: + type: string + description: Release number of Zenoh + required: false jobs: - checks: - name: Code checks + tag: + name: Branch, Bump & tag runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install Rust toolchain - run: rustup component add rustfmt clippy - - - name: Code format check - run: cargo fmt --check - - - name: Clippy check - run: cargo clippy --all-targets --all-features -- --deny warnings - - - name: Environment setup - id: env - shell: bash - run: | - # log some info - gcc --version || true - rustup -V - rustup toolchain list - rustup default - cargo -V - rustc -V - - echo "GITHUB_REF=${GITHUB_REF}" - echo "GITHUB_SHA=${GITHUB_SHA:0:8}" - GIT_BRANCH=`[[ $GITHUB_REF =~ ^refs/heads/.* ]] && echo ${GITHUB_REF/refs\/heads\//} || true` - echo "GIT_BRANCH=${GIT_BRANCH}" - echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_OUTPUT - GIT_TAG=`[[ $GITHUB_REF =~ ^refs/tags/.* ]] && echo ${GITHUB_REF/refs\/tags\//} || true` - echo "GIT_TAG=${GIT_TAG}" - echo "GIT_TAG=${GIT_TAG}" >> $GITHUB_OUTPUT - - ZENOH_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1) - echo "ZENOH_VERSION=${ZENOH_VERSION}" - echo "ZENOH_VERSION=${ZENOH_VERSION}" >> $GITHUB_OUTPUT - if [ -n "${GIT_TAG}" ]; then - IS_RELEASE="true" - echo "IS_RELEASE=${IS_RELEASE}" - echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_OUTPUT - PKG_VERSION=${ZENOH_VERSION} - elif [ -n "${GIT_BRANCH}" ]; then - PKG_VERSION=${GIT_BRANCH}-${GITHUB_SHA:0:8} - else - PKG_VERSION=${ZENOH_VERSION}-${GITHUB_SHA:0:8} - fi - echo "PKG_VERSION=${PKG_VERSION}" - echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_OUTPUT outputs: - GIT_BRANCH: ${{ steps.env.outputs.GIT_BRANCH }} - GIT_TAG: ${{ steps.env.outputs.GIT_TAG }} - IS_RELEASE: ${{ steps.env.outputs.IS_RELEASE }} - ZENOH_VERSION: ${{ steps.env.outputs.ZENOH_VERSION }} - PKG_VERSION: ${{ steps.env.outputs.PKG_VERSION }} - - builds: - name: Build for ${{ matrix.job.target }} on ${{ matrix.job.os }} - needs: checks - runs-on: ${{ matrix.job.os }} - strategy: - fail-fast: false - matrix: - job: - - { target: x86_64-unknown-linux-gnu, arch: amd64, os: ubuntu-20.04, build-cmd: "cargo" } - - { target: arm-unknown-linux-gnueabi, arch: armel, os: ubuntu-20.04, build-cmd: "cross" } - - { - target: arm-unknown-linux-gnueabihf, - arch: armhf, - os: ubuntu-20.04, - build-cmd: "cross", - } - - { - target: armv7-unknown-linux-gnueabihf, - arch: armhf, - os: ubuntu-20.04, - build-cmd: "cross", - } - - { target: aarch64-unknown-linux-gnu, arch: arm64, os: ubuntu-20.04, build-cmd: "cross" } - - { target: x86_64-apple-darwin, arch: darwin, os: macos-latest, build-cmd: "cargo" } - - { target: aarch64-apple-darwin, arch: darwin, os: macos-latest, build-cmd: "cargo" } - - { target: x86_64-pc-windows-msvc, arch: win64, os: windows-2019, build-cmd: "cargo" } - - { target: x86_64-pc-windows-gnu, arch: win64, os: windows-2019, build-cmd: "cargo" } - env: - CMAKE_CROSSCOMPILING: ON + version: ${{ steps.create-release-branch.outputs.version }} + branch: ${{ steps.create-release-branch.outputs.branch }} steps: - - name: Checkout source code - uses: actions/checkout@v4 + - id: create-release-branch + uses: eclipse-zenoh/ci/create-release-branch@main with: - fetch-depth: 500 # NOTE: get long history for git-version crate to correctly compute a version - - name: Fetch Git tags # NOTE: workaround for https://github.com/actions/checkout/issues/290 - shell: bash - run: git fetch --tags --force - - name: Install prerequisites - shell: bash - run: | - case ${{ matrix.job.target }} in - *-linux-gnu*) cargo install cargo-deb ;; - esac - - case ${{ matrix.job.target }} in - arm-unknown-linux-gnueabi) - sudo apt-get -y update - sudo apt-get -y install gcc-arm-linux-gnueabi - ;; - arm*-unknown-linux-gnueabihf) - sudo apt-get -y update - sudo apt-get -y install gcc-arm-linux-gnueabihf - ;; - aarch64-unknown-linux-gnu) - sudo apt-get -y update - sudo apt-get -y install gcc-aarch64-linux-gnu - ;; - esac - - cargo install cross --git https://github.com/cross-rs/cross - - - name: Install Rust toolchain - run: | - rustup set profile minimal - rustup target add ${{ matrix.job.target }} - - - name: Build for ${{ matrix.job.target }} target - run: ${{ matrix.job.build-cmd }} build --release --target=${{ matrix.job.target }} --features=logger-autoinit --features=shared-memory + repo: ${{ github.repository }} + live-run: ${{ inputs.live-run }} + version: ${{ inputs.version }} + github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }} - - name: Debian package - libzenohc - if: contains(matrix.job.target, '-linux-gnu') - run: cargo deb --no-build --no-strip --target=${{ matrix.job.target }} --variant=libzenohc - - - name: Debian package - libzenohc-dev - if: contains(matrix.job.target, '-linux-gnu') - run: cargo deb --no-build --no-strip --target=${{ matrix.job.target }} --variant=libzenohc-dev - - - name: Packaging - id: package - shell: bash - run: | - TARGET=${{ matrix.job.target }} - LIB_PKG_NAME="${GITHUB_WORKSPACE}/zenoh-c-${{ needs.checks.outputs.PKG_VERSION }}-${TARGET}.zip" - DEBS_PKG_NAME="${GITHUB_WORKSPACE}/zenoh-c-${{ needs.checks.outputs.PKG_VERSION }}-${TARGET}-deb-pkgs.zip" - - case ${TARGET} in - *linux*) - cd "target/${TARGET}/release/" - echo "Packaging ${LIB_PKG_NAME}:" - mkdir lib && cp libzenohc.so lib/ - zip -r ${LIB_PKG_NAME} lib - cd - - zip -r ${LIB_PKG_NAME} include - echo "LIB_PKG_NAME=${LIB_PKG_NAME}" >> $GITHUB_OUTPUT - - # check if debian packages has been created and packages them in a single tgz - if [[ -d target/${TARGET}/debian ]]; then - cd target/${TARGET}/debian - echo "Packaging ${DEBS_PKG_NAME}:" - zip ${DEBS_PKG_NAME} *.deb - cd - - echo "DEBS_PKG_NAME=${DEBS_PKG_NAME}" >> $GITHUB_OUTPUT - fi - ;; - *apple*) - cd "target/${TARGET}/release/" - echo "Packaging ${LIB_PKG_NAME}:" - mkdir lib && cp libzenohc.dylib lib/ - zip -r ${LIB_PKG_NAME} lib - cd - - zip -r ${LIB_PKG_NAME} include - echo "LIB_PKG_NAME=${LIB_PKG_NAME}" >> $GITHUB_OUTPUT - ;; - *windows*) - cd "target/${TARGET}/release/" - echo "Packaging ${LIB_PKG_NAME}:" - mkdir lib && cp zenohc.dll lib/ - 7z -y -r a "${LIB_PKG_NAME}" lib - cd - - 7z -y -r a "${LIB_PKG_NAME}" include - echo "LIB_PKG_NAME=${LIB_PKG_NAME}" >> $GITHUB_OUTPUT - ;; - esac - - - name: "Upload packages" - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.job.target }} - path: | - ${{ steps.package.outputs.LIB_PKG_NAME }} - ${{ steps.package.outputs.DEBS_PKG_NAME }} - - publication: - name: Publish the release - if: needs.checks.outputs.IS_RELEASE == 'true' - needs: [checks, builds] - runs-on: ubuntu-latest - steps: - - name: Download result of previous builds - uses: actions/download-artifact@v3 - with: - path: ARTIFACTS - - name: Publish as github release - uses: softprops/action-gh-release@v1 - with: - files: ARTIFACTS/*/*.* - - name: Publish to download.eclipse.org/zenoh + - name: Bump and tag project + run: bash ci/scripts/bump-and-tag.bash env: - SSH_TARGET: genie.zenoh@projects-storage.eclipse.org - ECLIPSE_BASE_DIR: /home/data/httpd/download.eclipse.org/zenoh/zenoh-c - shell: bash - run: | - echo "--- setup ssh-agent" - eval "$(ssh-agent -s)" - echo 'echo "${{ secrets.SSH_PASSPHRASE }}"' > ~/.ssh_askpass && chmod +x ~/.ssh_askpass - echo "${{ secrets.SSH_PRIVATE_KEY }}" | tr -d '\r' | DISPLAY=NONE SSH_ASKPASS=~/.ssh_askpass ssh-add - > /dev/null 2>&1 - rm -f ~/.ssh_askpass - echo "--- test ssh:" - ssh -o "StrictHostKeyChecking=no" ${SSH_TARGET} ls -al - echo "---- list artifacts to upload:" - ls -R ARTIFACTS || true - DOWNLOAD_DIR=${ECLIPSE_BASE_DIR}/${{ needs.checks.outputs.ZENOH_VERSION }} - echo "---- copy artifacts into ${DOWNLOAD_DIR}" - ssh -o "StrictHostKeyChecking=no" ${SSH_TARGET} mkdir -p ${DOWNLOAD_DIR} - cd ARTIFACTS - sha256sum */* > sha256sums.txt - scp -o "StrictHostKeyChecking=no" -r * ${SSH_TARGET}:${DOWNLOAD_DIR}/ - echo "---- cleanup identity" - ssh-add -D + REPO: ${{ github.repository }} + VERSION: ${{ steps.create-release-branch.outputs.version }} + BRANCH: ${{ steps.create-release-branch.outputs.branch }} + BUMP_DEPS_VERSION: ${{ inputs.zenoh-version }} + BUMP_DEPS_PATTERN: ${{ inputs.zenoh-version && 'zenoh.*' || '^$' }} + BUMP_DEPS_BRANCH: ${{ inputs.zenoh-version && format('release/{0}', inputs.zenoh-version) || '' }} + GH_TOKEN: ${{ secrets.BOT_TOKEN_WORKFLOW }} + GIT_USER_NAME: eclipse-zenoh-bot + GIT_USER_EMAIL: eclipse-zenoh-bot@users.noreply.github.com + + build-debian: + name: Build Debian packages + needs: tag + uses: eclipse-zenoh/ci/.github/workflows/build-crates-debian.yml@main + with: + repo: ${{ github.repository }} + version: ${{ needs.tag.outputs.version }} + branch: ${{ needs.tag.outputs.branch }} + secrets: inherit + + build-standalone: + name: Build executables and libraries + needs: tag + uses: eclipse-zenoh/ci/.github/workflows/build-crates-standalone.yml@main + with: + repo: ${{ github.repository }} + version: ${{ needs.tag.outputs.version }} + branch: ${{ needs.tag.outputs.branch }} + artifact-patterns: | + ^libzenohc\.(dylib|so)$ + ^zenohc\.dll$ + ^include$ + secrets: inherit + + debian: + name: Publish Debian packages + needs: [tag, build-debian] + uses: eclipse-zenoh/ci/.github/workflows/release-crates-debian.yml@main + with: + no-build: true + live-run: ${{ inputs.live-run || false }} + version: ${{ needs.tag.outputs.version }} + repo: ${{ github.repository }} + branch: ${{ needs.tag.outputs.branch }} + installation-test: false + secrets: inherit + + homebrew: + name: Publish Homebrew formulae + needs: [tag, build-standalone] + uses: eclipse-zenoh/ci/.github/workflows/release-crates-homebrew.yml@main + with: + no-build: true + repo: ${{ github.repository }} + live-run: ${{ inputs.live-run || false }} + version: ${{ needs.tag.outputs.version }} + branch: ${{ needs.tag.outputs.branch }} + artifact-patterns: | + ^libzenohc\.dylib$ + ^include$ + formulae: | + libzenohc + secrets: inherit + + eclipse: + name: Publish artifacts to Eclipse downloads + needs: [tag, build-standalone] + uses: eclipse-zenoh/ci/.github/workflows/release-crates-eclipse.yml@main + with: + no-build: true + live-run: ${{ inputs.live-run || false }} + version: ${{ needs.tag.outputs.version }} + repo: ${{ github.repository }} + branch: ${{ needs.tag.outputs.branch }} + artifact-patterns: | + ^libzenohc\.(dylib|so)$ + ^zenohc\.dll$ + ^include$ + name: zenoh-c + secrets: inherit + + github: + name: Publish artifacts to GitHub Releases + needs: [tag, build-standalone] + uses: eclipse-zenoh/ci/.github/workflows/release-crates-github.yml@main + with: + no-build: true + live-run: ${{ inputs.live-run || false }} + version: ${{ needs.tag.outputs.version }} + repo: ${{ github.repository }} + branch: ${{ needs.tag.outputs.branch }} + artifact-patterns: | + ^libzenohc\.(dylib|so)$ + ^zenohc\.dll$ + ^include$ + secrets: inherit diff --git a/ci/scripts/bump.bash b/ci/scripts/bump.bash index e77d3ae1c..3c3bae3cf 100644 --- a/ci/scripts/bump.bash +++ b/ci/scripts/bump.bash @@ -2,12 +2,24 @@ set -eo pipefail -# Project version +# Repository +readonly REPO +# Release number readonly VERSION -# Zenoh dependencies' version -readonly ZENOH_VERSION -# Zenoh dependencies' git branch -readonly ZENOH_BRANCH +# Release branch +readonly BRANCH +# Dependencies' pattern +readonly BUMP_DEPS_PATTERN +# Dependencies' version +readonly BUMP_DEPS_VERSION +# Dependencies' git branch +readonly BUMP_DEPS_BRANCH +# GitHub token +readonly GH_TOKEN +# Git actor name +readonly GIT_USER_NAME +# Git actor email +readonly GIT_USER_EMAIL cargo +stable install toml-cli @@ -19,6 +31,13 @@ function toml_set_in_place() { mv "$tmp" "$1" } +export GIT_AUTHOR_NAME=$GIT_USER_NAME +export GIT_AUTHOR_EMAIL=$GIT_USER_EMAIL +export GIT_COMMITTER_NAME=$GIT_USER_NAME +export GIT_COMMITTER_EMAIL=$GIT_USER_EMAIL + +git clone --recursive --single-branch --branch "$BRANCH" "https://github.com/$REPO" + # Bump CMake project version sed -i "s;^set(ZENOHC_VERSION .*)$;set(ZENOHC_VERSION $VERSION);" CMakeLists.txt # Propagate version change to Cargo.toml and Cargo.toml.in @@ -31,24 +50,30 @@ toml_set_in_place Cargo.toml.in "package.metadata.deb.variants.libzenohc-dev.dep git commit CMakeLists.txt Cargo.toml Cargo.toml.in Cargo.lock -m "chore: Bump version to $VERSION" -# Select all package dependencies that match 'zenoh.*' and bump them to $ZENOH_VERSION -zenoh_deps=$(toml get Cargo.toml dependencies | jq -r 'keys.[] | select(test("zenoh.*"))') -for dep in $zenoh_deps; do - if [[ -n $ZENOH_VERSION ]]; then - toml_set_in_place Cargo.toml "dependencies.$dep.version" "$ZENOH_VERSION" - toml_set_in_place Cargo.toml.in "dependencies.$dep.version" "$ZENOH_VERSION" +# Select all package dependencies that match $BUMP_DEPS_PATTERN and bump them to $BUMP_DEPS_VERSION +deps=$(toml get Cargo.toml dependencies | jq -r "keys.[] | select(test(\"$BUMP_DEPS_PATTERN\"))") +for dep in $deps; do + if [[ -n $BUMP_DEPS_VERSION ]]; then + toml_set_in_place Cargo.toml "dependencies.$dep.version" "$BUMP_DEPS_VERSION" + toml_set_in_place Cargo.toml.in "dependencies.$dep.version" "$BUMP_DEPS_VERSION" fi - if [[ -n $ZENOH_BRANCH ]]; then - toml_set_in_place Cargo.toml "dependencies.$dep.branch" "$ZENOH_BRANCH" - toml_set_in_place Cargo.toml.in "dependencies.$dep.branch" "$ZENOH_BRANCH" + if [[ -n $BUMP_DEPS_BRANCH ]]; then + toml_set_in_place Cargo.toml "dependencies.$dep.branch" "$BUMP_DEPS_BRANCH" + toml_set_in_place Cargo.toml.in "dependencies.$dep.branch" "$BUMP_DEPS_BRANCH" fi done # Update lockfile cargo check -if [[ -n $ZENOH_VERSION || -n $ZENOH_BRANCH ]]; then - git commit Cargo.toml Cargo.toml.in Cargo.lock -m "chore: Bump Zenoh version to $ZENOH_VERSION" +if [[ -n $BUMP_DEPS_VERSION || -n $BUMP_DEPS_BRANCH ]]; then + git commit Cargo.toml Cargo.toml.in Cargo.lock -m "chore: Bump $BUMP_DEPS_PATTERN + version to $BUMP_DEPS_VERSION" else - echo "info: no changes have been made to Zenoh dependencies" + echo "info: no changes have been made to any dependencies" fi + +git tag "$VERSION" -m "v$VERSION" +git log -10 +git show-ref --tags +git push "https://$GH_TOKEN@github.com/$REPO" "$BRANCH" "$VERSION"