Release #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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" | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+*" | |
workflow_dispatch: | |
jobs: | |
builds: | |
name: Build for ${{ matrix.job.target }} on ${{ matrix.job.os }} | |
runs-on: [ self-hosted, "${{ matrix.job.os }}" ] | |
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 } | |
- { target: x86_64-pc-windows-msvc, arch: win64, os: windows-10 } | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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') }} | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --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') | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --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: | |
name: Release publication | |
needs: builds | |
runs-on: [ self-hosted, ubuntu-20.04 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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.GITHUB_TOKEN }} |