meshlab/.github/workflows/CreateRelease.yml
2023-03-27 15:46:48 +02:00

264 lines
9.7 KiB
YAML

name: CreateRelease
on:
#[push, pull_request] #just for test release scripts
workflow_dispatch: #manual run
inputs:
version:
description: 'New MeshLab Version'
required: true
default: 'YYYY.MM'
env:
QT_VERSION: 5.15.2
jobs:
update_ml_version:
name: Update ML_VERSION
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Update MeshLab version
run : |
echo ${{ github.event.inputs.version }} | tr -d '\n'> ML_VERSION
- name: commit ML_VERSION change
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Set MeshLab version to ${{ github.event.inputs.version }}
meshlab_build:
needs: [update_ml_version]
name: Build MeshLab
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-18.04', 'macos-latest', 'windows-latest']
precision: [single_precision, double_precision]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
ref: main
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Set CodeSign Certificate macOS
if: runner.os == 'macOS'
uses: apple-actions/import-codesign-certs@v2
with:
p12-file-base64: ${{ secrets.MACOS_CERTIFICATE }}
p12-password: ${{ secrets.MACOS_CERTIFICATE_PSSW }}
- name: Set CodeSign Certificate Windows
if: runner.os == 'Windows'
run: |
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_CERTIFICATE }}'
certutil -decode certificate\certificate.txt certificate\certificate.pfx
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
cache: true
version: ${{ env.QT_VERSION }}
- name: Install dependencies
shell: bash
run: |
bash scripts/${{ runner.os }}/0_setup_env.sh --dont_install_qt --dont_install_cgal_and_boost
- name: Setup env variables
id: envs
shell: bash
run: |
if [ "${{matrix.precision}}" == "double_precision" ]; then
echo "artifact_suffix=_double" >> $GITHUB_OUTPUT
else
echo "artifact_suffix=" >> $GITHUB_OUTPUT
fi
- name: Cache external libraries sources
id: cache-ext-libs
uses: actions/cache@v3
with:
path: src/external/downloads/*
key: ${{ runner.os }}-external-libraries
- name: Ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-${{ github.ref }}-${{ matrix.precision }}
- name: Configure and Build
shell: bash
run: |
bash scripts/${{ runner.os }}/1_build.sh --${{ matrix.precision }} --ccache
- name: Deploy
shell: bash
run: |
bash scripts/${{ runner.os }}/2_deploy.sh --cert_pssw='${{ secrets.WIN_CERTIFICATE_PSSW }}' --cert_id=${{ secrets.MACOS_CERT_ID }}
- name: Get AppBundle Name
if: runner.os == 'macOS'
id: abn
shell: bash
run: |
cd install
NAME=$(ls -d MeshLab*)
echo "app_bundle_name=$NAME" >> $GITHUB_OUTPUT
- name: Notarize macOS
if: runner.os == 'macOS'
uses: devbotsxyz/xcode-notarize@v1
with:
product-path: "install/${{steps.abn.outputs.app_bundle_name}}"
appstore-connect-username: ${{ secrets.MACOS_NOTARIZATION_USER }}
appstore-connect-password: ${{ secrets.MACOS_NOTARIZATION_PSSW }}
- name: Staple Release macOS
if: runner.os == 'macOS'
uses: devbotsxyz/xcode-staple@v1
with:
product-path: "install/${{steps.abn.outputs.app_bundle_name}}"
- name: Upload MeshLab Portable
uses: actions/upload-artifact@v3
with:
name: MeshLab_${{ runner.os }}_portable${{steps.envs.outputs.artifact_suffix}}
path: install/
- name: Upload MeshLab Packages
uses: actions/upload-artifact@v3
with:
name: MeshLab_${{ runner.os }}_packages${{steps.envs.outputs.artifact_suffix}}
path: packages/MeshLab*
#after building MeshLab for the three platforms, we create a release in github
create_release:
name: Create Release
needs: [meshlab_build]
runs-on: ubuntu-latest
steps:
#Download Linux Packages
- name: Download Linux ZIP
uses: actions/download-artifact@v3
with:
name: MeshLab_Linux_portable
path: meshlab_linux_portable
- name: Download Linux ZIP-d
uses: actions/download-artifact@v3
with:
name: MeshLab_Linux_portable_double
path: meshlab_linux_portable_double
- name: Download Linux AppImage
uses: actions/download-artifact@v3
with:
name: MeshLab_Linux_packages
path: meshlab_linux_appimage
- name: Download Linux AppImage-d
uses: actions/download-artifact@v3
with:
name: MeshLab_Linux_packages_double
path: meshlab_linux_appimage_double
- name: Change Permissions
run: |
chmod +x meshlab_linux_portable/usr/bin/meshlab
chmod +x meshlab_linux_portable/AppRun
chmod +x meshlab_linux_portable_double/usr/bin/meshlab
chmod +x meshlab_linux_portable_double/AppRun
- name: Setup env variables
id: envs
shell: bash
run: |
#get version of meshlab
IFS=' ' #space delimiter
STR_VERSION=$(meshlab_linux_portable/usr/bin/meshlab --version)
read -a strarr <<< "$STR_VERSION"
ML_VERSION=${strarr[1]} #get the meshlab version from the string
echo "ml_version=$ML_VERSION" >> $GITHUB_OUTPUT
STR_VERSION=$(meshlab_linux_portable_double/usr/bin/meshlab --version)
read -a strarrd <<< "$STR_VERSION"
ML_VERSION_D=${strarrd[1]} #get the meshlab version from the string
echo "ml_version_d=$ML_VERSION_D" >> $GITHUB_OUTPUT
#access to this variable using ${{steps.envs.outputs.ml_version}} or ${{steps.envs.outputs.ml_version_d}}
- name: Create MeshLab Portable Linux Archive
run: |
cd meshlab_linux_portable
tar -cvzf ../MeshLab${{steps.envs.outputs.ml_version}}-linux.tar.gz *
cd ../meshlab_linux_portable_double
tar -cvzf ../MeshLab${{steps.envs.outputs.ml_version_d}}-linux.tar.gz *
cd ..
#Download MacOS Package
- name: Download MacOS DMG
uses: actions/download-artifact@v3
with:
name: MeshLab_macOS_packages
path: meshlab_macos_dmg
- name: Download MacOS DMG-d
uses: actions/download-artifact@v3
with:
name: MeshLab_macOS_packages_double
path: meshlab_macos_dmg_double
- name: Download MacOS Portable
uses: actions/download-artifact@v3
with:
name: MeshLab_macOS_portable
path: meshlab_macos_portable
- name: Download MacOS Portable-d
uses: actions/download-artifact@v3
with:
name: MeshLab_macOS_portable_double
path: meshlab_macos_portable_double
- name: Change Permissions
run: |
chmod +x meshlab_macos_portable/MeshLab*.app/Contents/MacOS/meshlab
chmod +x meshlab_macos_portable_double/MeshLab*.app/Contents/MacOS/meshlab
- name: Create MeshLab Portable MacOS
run: |
cd meshlab_macos_portable
tar -cvzf ../MeshLab${{steps.envs.outputs.ml_version}}-macos.tar.gz *
cd ../meshlab_macos_portable_double
tar -cvzf ../MeshLab${{steps.envs.outputs.ml_version_d}}-macos.tar.gz *
cd ..
#Download Windows Packages
- name: Download Windows ZIP
uses: actions/download-artifact@v3
with:
name: MeshLab_Windows_portable
path: meshlab_windows_portable
- name: Download Windows ZIP-d
uses: actions/download-artifact@v3
with:
name: MeshLab_Windows_portable_double
path: meshlab_windows_portable_double
- name: Download Windows Installer
uses: actions/download-artifact@v3
with:
name: MeshLab_Windows_packages
path: meshlab_windows_installer
- name: Download Windows Installer-d
uses: actions/download-artifact@v3
with:
name: MeshLab_Windows_packages_double
path: meshlab_windows_installer_double
- name: Create MeshLab Portable Windows Archive
run: |
cd meshlab_windows_portable
zip -r ../MeshLab${{steps.envs.outputs.ml_version}}-windows.zip *
cd ../meshlab_windows_portable_double
zip -r ../MeshLab${{steps.envs.outputs.ml_version_d}}-windows.zip *
cd ..
#Create release and upload
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "MeshLab-${{steps.envs.outputs.ml_version}}"
prerelease: false #${{ github.event.inputs.release_candidate }}
title: "MeshLab-${{steps.envs.outputs.ml_version}}"
files: |
MeshLab${{steps.envs.outputs.ml_version}}-linux.tar.gz
MeshLab${{steps.envs.outputs.ml_version_d}}-linux.tar.gz
meshlab_linux_appimage/MeshLab${{steps.envs.outputs.ml_version}}-linux.AppImage
meshlab_linux_appimage_double/MeshLab${{steps.envs.outputs.ml_version_d}}-linux.AppImage
MeshLab${{steps.envs.outputs.ml_version}}-macos.tar.gz
MeshLab${{steps.envs.outputs.ml_version_d}}-macos.tar.gz
meshlab_macos_dmg/MeshLab${{steps.envs.outputs.ml_version}}-macos.dmg
meshlab_macos_dmg_double/MeshLab${{steps.envs.outputs.ml_version_d}}-macos.dmg
MeshLab${{steps.envs.outputs.ml_version}}-windows.zip
MeshLab${{steps.envs.outputs.ml_version_d}}-windows.zip
meshlab_windows_installer/MeshLab${{steps.envs.outputs.ml_version}}-windows.exe
meshlab_windows_installer_double/MeshLab${{steps.envs.outputs.ml_version_d}}-windows.exe