mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-07 04:46:25 +00:00
Choco action (#2335)
* check cron based trigger isolated * check cron based trigger isolated * fix args * add scheduled choco build action * revert to original * fix action name * fix action name * remove apt install as required packages exist already in the container * remove apt install as required packages exist already in the container
This commit is contained in:
@@ -0,0 +1,98 @@
|
|||||||
|
name: Publish-blenderbim-chocolatey package
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# ┌───────────── minute (0 - 59)
|
||||||
|
# │ ┌───────────── hour (0 - 23)
|
||||||
|
# │ │ ┌───────────── day of the month (1 - 31)
|
||||||
|
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
|
||||||
|
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
|
||||||
|
# * * * * *
|
||||||
|
- cron: "55 23 * * *" # 5min before utc midnight
|
||||||
|
|
||||||
|
env:
|
||||||
|
major: 0
|
||||||
|
minor: 0
|
||||||
|
name: blenderbim
|
||||||
|
choco_version: 1.1.0
|
||||||
|
CHOCO_TOKEN: ${{ secrets.CHOCO_TOKEN }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
activate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Set env
|
||||||
|
run: echo ok go
|
||||||
|
|
||||||
|
build:
|
||||||
|
needs: activate
|
||||||
|
name: ${{ matrix.config.name }}-${{ matrix.pyver }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
pyver: [py310]
|
||||||
|
config:
|
||||||
|
- {
|
||||||
|
name: "Windows Build",
|
||||||
|
short_name: win,
|
||||||
|
}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2 # https://github.com/actions/setup-python
|
||||||
|
with:
|
||||||
|
python-version: '3.7.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
||||||
|
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
|
||||||
|
- run: echo ${{ env.DATE }}
|
||||||
|
|
||||||
|
- name: Check in published releases if we should do a choco release
|
||||||
|
id: do_choco
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=choco_release::$(python3 /home/runner/work/IfcOpenShell/IfcOpenShell/choco/blenderbim/check_repo_infos.py --do_choco_release?)"
|
||||||
|
|
||||||
|
- name: Compile
|
||||||
|
if: ${{steps.do_choco.outputs.choco_release}} == 'do_choco_release'
|
||||||
|
run: |
|
||||||
|
target_os=${{ matrix.config.short_name }} &&
|
||||||
|
pyver=$(python3 /home/runner/work/IfcOpenShell/IfcOpenShell/choco/blenderbim/check_repo_infos.py --pyver?) &&
|
||||||
|
cp -r src/blenderbim src/blenderbim_$target_os_$pyver &&
|
||||||
|
cd src/blenderbim_$target_os_$pyver &&
|
||||||
|
make dist PLATFORM=$target_os PYVERSION=$pyver
|
||||||
|
|
||||||
|
- name: Fill chocolatey scripts on win with latest blender python
|
||||||
|
if: ${{steps.do_choco.outputs.choco_release}} == 'do_choco_release'
|
||||||
|
run: |
|
||||||
|
today_non_iso="$(date +'%y%m%d' | tr -d '\n')" &&
|
||||||
|
target_os=${{ matrix.config.short_name }} &&
|
||||||
|
latest_blender_python_version_maj_min=$(python3 /home/runner/work/IfcOpenShell/IfcOpenShell/choco/blenderbim/check_repo_infos.py --latest_blender_python_version_maj_min?) &&
|
||||||
|
echo "latest_blender_python_version_maj_min?: $latest_blender_python_version_maj_min" &&
|
||||||
|
pyver=$(python3 /home/runner/work/IfcOpenShell/IfcOpenShell/choco/blenderbim/check_repo_infos.py --pyver?) &&
|
||||||
|
export latest_blender_version_maj_min=$(python3 /home/runner/work/IfcOpenShell/IfcOpenShell/choco/blenderbim/check_repo_infos.py --latest_blender_release_maj_min?) &&
|
||||||
|
export latest_blender_version_maj_min_pat=$(python3 /home/runner/work/IfcOpenShell/IfcOpenShell/choco/blenderbim/check_repo_infos.py --latest_blender_release_maj_min_pat?) &&
|
||||||
|
echo latest_blender_version_maj_min_pat?: $latest_blender_version_maj_min_pat &&
|
||||||
|
export blenderbim_build_version="${{ env.major }}.${{ env.minor }}.$today_non_iso" &&
|
||||||
|
export url_blenderbim_py310_win_zip="https://github.com/IfcOpenShell/IfcOpenShell/releases/download/blenderbim-$today_non_iso/blenderbim-$today_non_iso-$pyver-$target_os.zip" &&
|
||||||
|
export sha256sum_blenderbim_py310_win_zip=$( sha256sum src/blenderbim_$target_os_$pyver/dist/blenderbim-$today_non_iso-$pyver-$target_os.zip --tag | cut -d ' ' -f 4 | tr -d '\n') &&
|
||||||
|
echo sha256sum_blenderbim_py310_win_zip: $sha256sum_blenderbim_py310_win_zip &&
|
||||||
|
python3 choco/blenderbim/fill_dynamic_parameters.py &&
|
||||||
|
echo __build choco with mono &&
|
||||||
|
wget "https://github.com/chocolatey/choco/archive/refs/tags/$choco_version.tar.gz" --quiet &&
|
||||||
|
tar -xzf "$choco_version.tar.gz" &&
|
||||||
|
cd choco-$choco_version &&
|
||||||
|
chmod +x build.sh zip.sh &&
|
||||||
|
./build.sh &&
|
||||||
|
cp -r build_output/chocolatey /opt/chocolatey &&
|
||||||
|
cd /home/runner/work/IfcOpenShell/IfcOpenShell/choco/blenderbim/ &&
|
||||||
|
echo __choco pack &&
|
||||||
|
mono /opt/chocolatey/choco.exe --version &&
|
||||||
|
mono /opt/chocolatey/choco.exe pack --allow-unofficial &&
|
||||||
|
echo __choco set apiKey &&
|
||||||
|
mono /opt/chocolatey/choco.exe setapikey --key="$CHOCO_TOKEN" --source="https://push.chocolatey.org/" --allow-unofficial # &&
|
||||||
|
echo __choco push &&
|
||||||
|
mono /opt/chocolatey/choco.exe push --source="https://push.chocolatey.org/" --key="$CHOCO_TOKEN" --allow-unofficial --verbose
|
||||||
|
|
||||||
|
- name: Inform user about not packaging
|
||||||
|
if: ${{steps.do_choco.outputs.choco_release}} != 'do_choco_release'
|
||||||
|
run: |
|
||||||
|
echo "no releases found today ${{ env.DATE }}, therefore choco packaging is skipped."
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import sys
|
|
||||||
import re
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
from urllib import request
|
from urllib import request
|
||||||
|
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ if sys.argv[1] == "--do_choco_release?":
|
|||||||
print("do_choco_release", end="")
|
print("do_choco_release", end="")
|
||||||
|
|
||||||
|
|
||||||
elif sys.argv[1] == "--latest_blender_release_min_maj_pat?":
|
elif sys.argv[1] == "--latest_blender_release_maj_min_pat?":
|
||||||
re_blender_version_min_maj_pat = r"Latest Version.+<span>Blender (\d+\.\d+\.\d+)</span>"
|
re_blender_version_min_maj_pat = r"Latest Version.+<span>Blender (\d+\.\d+\.\d+)</span>"
|
||||||
url = "https://community.chocolatey.org/packages/blender"
|
url = "https://community.chocolatey.org/packages/blender"
|
||||||
resp = request_repo_info(url)
|
resp = request_repo_info(url)
|
||||||
@@ -32,7 +32,7 @@ elif sys.argv[1] == "--latest_blender_release_min_maj_pat?":
|
|||||||
print(found[0], end="")
|
print(found[0], end="")
|
||||||
|
|
||||||
|
|
||||||
elif sys.argv[1] == "--latest_blender_release_min_maj?":
|
elif sys.argv[1] == "--latest_blender_release_maj_min?":
|
||||||
re_blender_version_min_maj = r"Latest Version.+<span>Blender (\d+\.\d+)\..+</span>"
|
re_blender_version_min_maj = r"Latest Version.+<span>Blender (\d+\.\d+)\..+</span>"
|
||||||
url = "https://community.chocolatey.org/packages/blender"
|
url = "https://community.chocolatey.org/packages/blender"
|
||||||
resp = request_repo_info(url)
|
resp = request_repo_info(url)
|
||||||
@@ -41,6 +41,7 @@ elif sys.argv[1] == "--latest_blender_release_min_maj?":
|
|||||||
if found:
|
if found:
|
||||||
print(found[0], end="")
|
print(found[0], end="")
|
||||||
|
|
||||||
|
|
||||||
elif sys.argv[1] == "--latest_blender_python_version_maj_min?":
|
elif sys.argv[1] == "--latest_blender_python_version_maj_min?":
|
||||||
# get latest blender version first
|
# get latest blender version first
|
||||||
re_blender_version_min_maj_pat = r"Latest Version.+<span>Blender (\d+\.\d+\.\d+)</span>"
|
re_blender_version_min_maj_pat = r"Latest Version.+<span>Blender (\d+\.\d+\.\d+)</span>"
|
||||||
|
|||||||
Reference in New Issue
Block a user