Skip to content

Commit

Permalink
fix(workflows/release): Sync actions/upload-artifact and actions/down…
Browse files Browse the repository at this point in the history
…load-artifact versions (v3)
  • Loading branch information
fuzzypixelz committed Dec 18, 2023
1 parent 6316838 commit 0034974
Showing 1 changed file with 30 additions and 18 deletions.
48 changes: 30 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ jobs:
name: Preparation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Clone this repository
uses: actions/checkout@v4

- name: Environment setup
id: env
shell: bash
Expand All @@ -34,32 +36,32 @@ jobs:
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 ::set-output name=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 ::set-output name=GIT_TAG::"${GIT_TAG}"
echo "GIT_TAG=${GIT_TAG}" >> $GITHUB_OUTPUT
ZENOH_VERSION=$(sed -n 's/^project(libzenohpico VERSION \(.*\) LANGUAGES C)/\1/p' CMakeLists.txt | head -n1)
echo "ZENOH_VERSION=${ZENOH_VERSION}"
echo ::set-output name=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 ::set-output name=IS_RELEASE::"${IS_RELEASE}"
echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_OUTPUT
PKG_VERSION=${GIT_TAG}
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 ::set-output name=PKG_VERSION::"${PKG_VERSION}"
echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_OUTPUT
CROSSBUILD_TARGETS=$(sed -n 's/^CROSSBUILD_TARGETS=\(.*\)/\1/p' GNUmakefile | head -n1)
echo "CROSSBUILD_TARGETS=$CROSSBUILD_TARGETS"
TARGET_MATRIX="{\"target\": [\"${CROSSBUILD_TARGETS// /\",\"}\"]}"
echo "TARGET_MATRIX=$TARGET_MATRIX"
echo ::set-output name=TARGET_MATRIX::"${TARGET_MATRIX}"
echo "TARGET_MATRIX=$TARGET_MATRIX" >> $GITHUB_OUTPUT
outputs:
GIT_BRANCH: ${{ steps.env.outputs.GIT_BRANCH }}
GIT_TAG: ${{ steps.env.outputs.GIT_TAG }}
Expand All @@ -73,11 +75,14 @@ jobs:
needs: preps
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Clone this repository
uses: actions/checkout@v4

- name: MacOS build
run: make
env:
BUILD_TYPE: RELEASE

- name: Packaging
id: package
shell: bash
Expand All @@ -86,14 +91,15 @@ jobs:
echo "Packaging ${LIB_PKG_NAME}:"
cd build && zip -r ${LIB_PKG_NAME} lib && cd -
zip -r ${LIB_PKG_NAME} include
echo ::set-output name=LIB_PKG_NAME::"${LIB_PKG_NAME}"
echo "LIB_PKG_NAME=${LIB_PKG_NAME}" >> $GITHUB_OUTPUT
EXP_PKG_NAME=${PWD}/zenoh-pico-${{ needs.preps.outputs.PKG_VERSION }}-macos-x64-examples.zip
echo "Packaging ${EXP_PKG_NAME}:"
cd build/examples && zip ${EXP_PKG_NAME} * && cd -
echo ::set-output name=EXP_PKG_NAME::"${EXP_PKG_NAME}"
echo "EXP_PKG_NAME=${EXP_PKG_NAME}" >> $GITHUB_OUTPUT
- name: "Upload x86_64 macos package"
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: macos-x64
path: |
Expand All @@ -108,11 +114,14 @@ jobs:
fail-fast: false
matrix: ${{fromJson(needs.preps.outputs.TARGET_MATRIX)}}
steps:
- uses: actions/checkout@v4
- name: Clone this repository
uses: actions/checkout@v4

- name: make for ${{ matrix.target }}
env:
BUILD_TYPE: RELEASE
run: make ${{ matrix.target }}

- name: Packaging
id: package
shell: bash
Expand All @@ -126,22 +135,23 @@ jobs:
echo "Packaging ${LIB_PKG_NAME}:"
cd crossbuilds/${TARGET} && zip -r ${LIB_PKG_NAME} lib && cd -
zip -r ${LIB_PKG_NAME} include
echo ::set-output name=LIB_PKG_NAME::"${LIB_PKG_NAME}"
echo "LIB_PKG_NAME=${LIB_PKG_NAME}" >> $GITHUB_OUTPUT
cd crossbuilds/${TARGET}/packages
echo "Packaging ${DEB_PKG_NAME}:"
zip ${DEB_PKG_NAME} *.deb
echo ::set-output name=DEB_PKG_NAME::"${DEB_PKG_NAME}"
echo "DEB_PKG_NAME=${DEB_PKG_NAME}" >> $GITHUB_OUTPUT
echo "Packaging ${RPM_PKG_NAME}:"
zip ${RPM_PKG_NAME} *.rpm
echo ::set-output name=RPM_PKG_NAME::"${RPM_PKG_NAME}"
echo "RPM_PKG_NAME=${RPM_PKG_NAME}" >> $GITHUB_OUTPUT
cd -
echo "Packaging ${EXP_PKG_NAME}:"
cd crossbuilds/${TARGET}/examples && zip ${EXP_PKG_NAME} * && cd -
echo ::set-output name=EXP_PKG_NAME::"${EXP_PKG_NAME}"
echo "EXP_PKG_NAME=${EXP_PKG_NAME}" >> $GITHUB_OUTPUT
- name: "Upload packages"
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: |
Expand All @@ -157,13 +167,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download result of previous builds
uses: actions/download-artifact@v2
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
env:
SSH_TARGET: genie.zenoh@projects-storage.eclipse.org
Expand Down

0 comments on commit 0034974

Please sign in to comment.