freecad_bundle #553
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
name: freecad_bundle | |
on: | |
schedule: | |
- cron: "0 23 * * 1,5" | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build-bundles: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
max-parallel: 4 | |
fail-fast: false | |
matrix: | |
os: [windows-latest, macos-latest, macos-13, ubuntu-latest] | |
tag: ["weekly-builds"] | |
include: | |
- os: windows-latest | |
bundle_dir: conda/win | |
asset_pattern: FreeCAD_.*Windows-x86_64 | |
- os: macos-13 | |
bundle_dir: conda/osx | |
asset_pattern: FreeCAD_.*macOS-x86_64 | |
- os: macos-latest | |
bundle_dir: conda/osx | |
asset_pattern: FreeCAD_.*macOS-arm64 | |
- os: ubuntu-latest | |
bundle_dir: conda/linux | |
asset_pattern: FreeCAD_.*Linux-x86_64 | |
steps: | |
- if: matrix.os == 'windows-latest' | |
name: msys2 | |
uses: msys2/setup-msys2@v2 | |
- uses: actions/checkout@v4 | |
name: Checkout | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
use-mamba: true | |
miniforge-variant: Miniforge3 | |
- if: matrix.os == 'ubuntu-latest' | |
name: update linux | |
run: | | |
sudo apt-get update -qq && sudo apt-get install -y desktop-file-utils appstream zsync libfuse2 curl; | |
apt-get download libc6; | |
dpkg -x libc6*.deb libc6; | |
curl -LO https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage; | |
chmod a+x appimagetool-x86_64.AppImage; | |
- if: matrix.os == 'ubuntu-latest' && github.event_name != 'pull_request' | |
name: import GPG key | |
run: echo -e $GPG_KEY | gpg --batch --import | |
env: | |
GPG_KEY: ${{ secrets.GPG_KEY }} | |
- if: matrix.os != 'windows-latest' | |
name: install conda dependencies for unix | |
run: | | |
mamba env config vars set MAMBA_NO_BANNER=1 | |
mamba install p7zip sed curl -y -c conda-forge; | |
- if: matrix.os == 'windows-latest' | |
name: install conda dependencies for windows | |
run: | | |
mamba env config vars set MAMBA_NO_BANNER=1 | |
mamba install curl -y -c conda-forge; | |
- if: matrix.os != 'windows-latest' | |
name: create unix bundle | |
run: "bash ./create_bundle.sh" | |
working-directory: ${{ matrix.bundle_dir}} | |
env: | |
DEPLOY_RELEASE: ${{ matrix.tag }} | |
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} | |
APPIMAGETOOL_SIGN_PASSPHRASE: ${{ secrets.APPIMAGETOOL_SIGN_PASSPHRASE }} | |
- if: matrix.os == 'windows-latest' | |
name: create windows bundle | |
shell: cmd | |
run: "call create_bundle.bat" | |
working-directory: ${{ matrix.bundle_dir}} | |
env: | |
DEPLOY_RELEASE: ${{ matrix.tag }} | |
- if: (github.event_name != 'pull_request') | |
name: Upload binaries to release and remove old ones | |
working-directory: ${{ matrix.bundle_dir }} | |
env: | |
TARGET_REPO: ${{ github.repository }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DEPLOY_RELEASE: ${{ matrix.tag }} | |
ASSET_PATTERN: ${{ matrix.asset_pattern }} | |
shell: bash | |
run: | | |
# store list of existing assets before upload | |
# exclude files with the same name as new ones | |
version_name=$(cat bundle_name.txt) | |
OLD_ASSETS=$(gh release view -R "$TARGET_REPO" "$DEPLOY_RELEASE" --json assets \ | |
--jq ".assets[].name" | grep "$ASSET_PATTERN" | grep -vF $version_name || true; ) | |
# upload new assets | |
find . -type f -name "FreeCAD_*" -exec gh release upload --clobber -R "$TARGET_REPO" "$DEPLOY_RELEASE" {} \; | |
# remove old assets if upload was successful | |
if [ -n "$OLD_ASSETS" ]; then | |
while IFS= read -r asset; do | |
gh release delete-asset -y -R "$TARGET_REPO" "$DEPLOY_RELEASE" "$asset" | |
done <<< "$OLD_ASSETS" | |
fi |