Skip to content

Release

Release #4

Workflow file for this run

#
# Copyright (c) 2023 ZettaScale Technology
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
# which is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
#
# Contributors:
# ZettaScale Zenoh Team, <[email protected]>
#
name: Release
on:
schedule:
- cron: "0 0 * * 1-5"
workflow_dispatch:
inputs:
live-run:
type: boolean
description: Live-run
required: false
default: false
version:
type: string
description: Release number
required: false
zenoh-version:
type: string
description: Zenoh Release number
required: false
branch:
type: string
description: Release branch
required: false
jobs:
tag:
name: Branch, Bump & tag crates
uses: eclipse-zenoh/ci/.github/workflows/branch-bump-tag-crates.yml@main
with:
repo: ${{ github.repository }}
live-run: ${{ inputs.live-run || false }}
version: ${{ inputs.version }}
branch: ${{ inputs.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) || '' }}
secrets: inherit
builds:
name: Build for ${{ matrix.job.target }} on ${{ matrix.job.os }}
runs-on: ${{ matrix.job.os }}
needs: tag
strategy:
fail-fast: false
matrix:
job:
- { target: x86_64-unknown-linux-gnu, arch: amd64, os: ubuntu-20.04 }
- { target: aarch64-apple-darwin, arch: darwin, os: macos-14 }
- { target: x86_64-pc-windows-msvc, arch: win64, os: windows-10 }
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.tag.outputs.branch }}
- name: Setup the Wireshark library
id: wireshark_lib
shell: bash
run: |
case ${{ matrix.job.target }} in
*linux*)
echo "WIRESHARK_LIB_DIR=" >> $GITHUB_OUTPUT
;;
*apple*)
ln -snf $(find /Applications/Wireshark.app/Contents/Frameworks -name "libwireshark.*.dylib" | tail -n 1) libwireshark.dylib
echo "WIRESHARK_LIB_DIR=${{ github.workspace }}" >> $GITHUB_OUTPUT
;;
*windows*)
echo "WIRESHARK_LIB_DIR=" >> $GITHUB_OUTPUT
;;
esac
- name: Build
if: ${{! contains(matrix.job.target, 'windows') }}
run: cargo build --release
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
WIRESHARK_LIB_DIR: ${{ steps.wireshark_lib.outputs.WIRESHARK_LIB_DIR }}
- name: Build from source on Windows
if: contains(matrix.job.target, 'windows')
run: cargo build --release
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
- name: Packaging
id: package
shell: bash
run: |
PKG_NAME="${GITHUB_WORKSPACE}/${{ matrix.job.target }}.zip"
echo "Packaging ${PKG_NAME}:"
case ${{ matrix.job.target }} in
*linux*)
zip -j ${PKG_NAME} target/release/libzenoh_dissector.so
;;
*apple*)
mv target/release/libzenoh_dissector.dylib target/release/libzenoh_dissector.so
zip -j ${PKG_NAME} target/release/libzenoh_dissector.so
;;
*windows*)
PKG_NAME="${PKG_NAME//\\//}"
zip -j ${PKG_NAME} target/release/zenoh_dissector.dll
;;
esac
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.job.target }}
path: ${{ matrix.job.target }}.zip
if-no-files-found: error
publish:
if: ${{ inputs.live-run || false }}
name: Release publication
needs: [tag, builds]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.tag.outputs.branch }}
- name: Download the artifacts of previous builds
uses: actions/download-artifact@v4
with:
path: ARTIFACTS
- name: Generate the release note
run: |
echo "Compute sha256sum"
mkdir -p zip_files
cp ARTIFACTS/*/*.zip zip_files
cd zip_files
export SHA256SUM=$(sha256sum *.zip)
echo -e "$SHA256SUM"
cd -
echo "Record zenoh version"
command -v jq &> /dev/null || sudo apt install jq -y
export PKG_VER=$(cargo metadata | jq -r '.packages[] | select(.name == "zenoh-dissector") | .version')
export ZENOH_VER=$(cargo metadata | jq -r '.packages[] | select(.name == "zenoh-protocol") | .version')
envsubst < ${GITHUB_WORKSPACE}/.github/workflows/release-note.md > release-note.md
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
prerelease: true
files: ARTIFACTS/*/*.zip
generate_release_notes: true
body_path: release-note.md
append_body: true
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN_WORKFLOW }}