Add release binary upload from GHA. (#2623)

* Add release binary upload from GHA.
* Update get release so that it works with draft releases.
* Distinguish release from CI builds in package name
  - regular ci builds -> Cutter-git-<date>-<hash>-<platform>
  - release tags -> Cutter-git-<tag>-<platform>
This commit is contained in:
karliss 2021-03-15 21:08:19 +02:00 committed by GitHub
parent 8da70aaf05
commit 1abd2b7ab0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 14 deletions

View File

@ -64,17 +64,17 @@ artifacts:
- path: "%ARTIFACT_PATH%"
name: "%ARTIFACT_NAME%"
deploy:
description: 'Cutter binaries'
provider: GitHub
auth_token:
secure: 2SmsqS2RaX2N5c9UwUcfBwNmMX64FfPAZFShLyxIkZXiC8vLaYCHToWxBYEuWRSk
artifact: "%ARTIFACT_NAME%"
draft: true
prerelease: true
on:
appveyor_repo_tag: true
DEPLOY: true
#deploy:
# description: 'Cutter binaries'
# provider: GitHub
# auth_token:
# secure: 2SmsqS2RaX2N5c9UwUcfBwNmMX64FfPAZFShLyxIkZXiC8vLaYCHToWxBYEuWRSk
# artifact: "%ARTIFACT_NAME%"
# draft: true
# prerelease: true
# on:
# appveyor_repo_tag: true
# DEPLOY: true
for:
-

View File

@ -4,6 +4,10 @@ on:
push:
branches:
- master
tags:
- v*
- upload-test*
pull_request:
branches:
- master
@ -82,6 +86,17 @@ jobs:
run: |
# 0.56.1 doesn't work with python 3.5 on Ubuntu 16.04
pip install meson==0.56.0
- name: Prepare package id
shell: bash
run: |
if [[ "${{ startsWith(github.event.ref, 'refs/tags')}}" = "true" ]]
then
PACKAGE_ID="${{ github.event.ref }}"
else
PACKAGE_ID="git-`date "+%Y-%m-%d"`-${{ format('{0}', github.sha) }}"
fi
PACKAGE_ID=${PACKAGE_ID##refs/tags/}
echo PACKAGE_ID=$PACKAGE_ID >> $GITHUB_ENV
- name: cmake ubuntu
if: contains(matrix.os, 'ubuntu')
run: |
@ -156,9 +171,10 @@ jobs:
-ignore-glob=usr/share/RizinOrg/Cutter/plugins/native/librz_ghidra_cutter.so \
-verbose=2
find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
export APPIMAGE_FILE="Cutter-v$CUTTER_VERSION-x64.Linux.AppImage"
export APPIMAGE_FILE="Cutter-${PACKAGE_ID}-x64.Linux.AppImage"
mv Cutter-*-x86_64.AppImage "$APPIMAGE_FILE"
echo PACKAGE_NAME=$APPIMAGE_FILE >> $GITHUB_ENV
echo UPLOAD_ASSET_TYPE=application/x-executable >> $GITHUB_ENV
fi
- name: cmake macos
shell: bash
@ -171,6 +187,7 @@ jobs:
source scripts/prepare_breakpad_macos.sh
mkdir build
cd build
PACKAGE_NAME=Cutter-${PACKAGE_ID}-Darwin
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DPYTHON_LIBRARY="$CUTTER_DEPS_PYTHON_PREFIX/lib/libpython3.9.dylib" \
@ -185,13 +202,15 @@ jobs:
-DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON \
-DCUTTER_PACKAGE_RZ_GHIDRA=ON \
-DCUTTER_PACKAGE_JSDEC=ON \
-DCPACK_PACKAGE_FILE_NAME="$PACKAGE_NAME" \
-DCMAKE_FRAMEWORK_PATH="$BREAKPAD_FRAMEWORK_DIR" \
-DCPACK_BUNDLE_APPLE_CERT_APP="-" \
.. && \
make -j4;
make package
export CUTTER_VERSION=$(python3 ../scripts/get_version.py)
echo PACKAGE_NAME=Cutter-${CUTTER_VERSION}-Darwin.dmg >> $GITHUB_ENV
echo PACKAGE_NAME=${PACKAGE_NAME}.dmg >> $GITHUB_ENV
echo UPLOAD_ASSET_TYPE=application/x-apple-diskimage >> $GITHUB_ENV
- name: windows dependencies
if: contains(matrix.os, 'windows')
shell: bash
@ -211,7 +230,7 @@ jobs:
cd
mkdir build
cd build
set PACKAGE_NAME=cutter-git-x64.Windows
set PACKAGE_NAME=cutter-%PACKAGE_ID%-x64.Windows
cmake ^
-DCMAKE_BUILD_TYPE=Release ^
-DCUTTER_USE_BUNDLED_RIZIN=ON ^
@ -230,8 +249,25 @@ jobs:
cmake --build . --config Release
cmake --build . --config Release --target package
echo PACKAGE_NAME=%PACKAGE_NAME%.zip >> %GITHUB_ENV%
echo UPLOAD_ASSET_TYPE=application/zip >> %GITHUB_ENV%
- uses: actions/upload-artifact@v2
if: env.PACKAGE_NAME != null
with:
name: ${{ env.PACKAGE_NAME }}
path: build/${{ env.PACKAGE_NAME }}
- name: Get release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
id: get_release
uses: karliss/get-release@23b8b7144dd5b0c9d6942b2fb78bd9ae71546d03
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release assets
if: steps.get_release.outputs.upload_url != null && env.PACKAGE_NAME != null
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: build/${{ env.PACKAGE_NAME }}
asset_name: ${{ env.PACKAGE_NAME }}
asset_content_type: ${{ env.UPLOAD_ASSET_TYPE }}