Skip to content

Commit de3f2a3

Browse files
committed
Add workflow for autoamtic latest release
1 parent 63d5cb5 commit de3f2a3

3 files changed

Lines changed: 169 additions & 6 deletions

File tree

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# SPDX-FileCopyrightText: 2025 Howetuft, Johannes Hinrichs (CodeFHD)
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: BlendLuxCore Blender Latest Release
6+
7+
on:
8+
pull_request:
9+
branches:
10+
- for_v2.10
11+
push:
12+
branches:
13+
- for_v2.10
14+
workflow_dispatch:
15+
16+
jobs:
17+
build_bundles:
18+
name: Build bundles
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
23+
- name: Checkout main repository
24+
uses: actions/checkout@v4
25+
26+
- name: Prepare Blender install
27+
uses: gerlero/apt-install@v1
28+
with:
29+
packages: libxxf86vm1 libxfixes3 libxi6 libxkbcommon0 libgl1
30+
31+
- name: Prepare Python
32+
run: touch requirements.txt
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: '3.11'
38+
39+
- uses: moguri/setup-blender@v1
40+
with:
41+
blender-version: '4.2.7'
42+
43+
- uses: lukka/get-cmake@latest
44+
45+
- name: Package bundle
46+
shell: bash
47+
run: |
48+
build_dir="${{ github.workspace }}/build"
49+
mkdir ${build_dir}
50+
cmake -B ${build_dir} -S . -DCMAKE_BUILD_TYPE=Latest
51+
cmake --build ${build_dir}
52+
unzip -q "${build_dir}/BlendLuxCore-Latest.zip" -d "${{ github.workspace }}/unzip"
53+
54+
- name: Upload artifact
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: "BlendLuxCore"
58+
path: "${{ github.workspace }}/unzip/*"
59+
60+
#- name: Check if latest release exists
61+
# uses: f2calv/gha-check-release-exists@v2
62+
# with:
63+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
# ReleaseName: 'BlendLuxCore Latest'
65+
66+
- name: check_release_exists
67+
shell: bash
68+
run: |
69+
echo false > ${{ github.workspace }}/tmp_release_test
70+
gh release list --json name > ${{ github.workspace }}/tmp_releases
71+
jq -r -c .[].name ${{ github.workspace }}/tmp_releases | while read i; do
72+
echo $i
73+
if [[ "$i" = "BlendLuxCore Latest" ]]; then
74+
echo true > "${{ github.workspace }}/tmp_release_test"
75+
fi
76+
done
77+
TESTRESULT=$(cat ${{ github.workspace }}/tmp_release_test)
78+
echo $TESTRESULT
79+
echo "ReleaseExists=$TESTRESULT" >> "$GITHUB_OUTPUT"
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
id: check_release_exists
83+
84+
- name: test previous
85+
shell: bash
86+
run: |
87+
echo HEREITGOES
88+
echo ${{ steps.check-release-exists.outputs.ReleaseExists }}
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
92+
- name: Update latest tag
93+
uses: richardsimko/update-tag@v1
94+
with:
95+
tag_name: latest
96+
env:
97+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
99+
#- name: Delete previous latest release
100+
# uses: liudonghua123/delete-release-action@v1
101+
# with:
102+
# release_name: 'BlendLuxCore Latest'
103+
# if: |
104+
# ${{ steps.check-release-exists.outputs.ReleaseExists }} == 'true'
105+
# env:
106+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
108+
- name: Delete previous latest release
109+
shell: bash
110+
run: |
111+
gh release delete latest
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
115+
- name: Create new latest release
116+
uses: actions/create-release@v1
117+
env:
118+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119+
with:
120+
tag_name: latest
121+
release_name: 'BlendLuxCore Latest'
122+
draft: false
123+
prerelease: true
124+
125+
- name: Release
126+
uses: softprops/action-gh-release@v2
127+
if: github.event_name == 'release'
128+
with:
129+
files: ${{ github.workspace }}/build/BlendLuxCore-Latest.zip
130+
131+
- name: Release binaries
132+
uses: softprops/action-gh-release@v2
133+
with:
134+
files: ${{ github.workspace }}/build/BlendLuxCore-Latest.zip
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# SPDX-FileCopyrightText: 2025 Howetuft, Johannes Hinrichs (CodeFHD)
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: BlendLuxCore Blender Bundles
6+
7+
on:
8+
release:
9+
types:
10+
- published
11+
12+
jobs:
13+
build_bundles:
14+
name: Add binaries to release
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Release binaries
19+
uses: softprops/action-gh-release@v2
20+
if: github.event_name == 'release'
21+
with:
22+
files: ${{ github.workspace }}/build/BlendLuxCore-*.zip

CMakeLists.txt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ cmake_minimum_required(VERSION 3.25)
66

77
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
88
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
9+
if(NOT CMAKE_BUILD_TYPE)
10+
set(CMAKE_BUILD_TYPE "Release")
11+
endif()
912

1013
project(BlendLuxCore LANGUAGES NONE)
1114
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
@@ -36,12 +39,16 @@ endfunction()
3639

3740
# Get BlendLuxCore version
3841
find_package(Python 3.11 REQUIRED COMPONENTS Interpreter)
39-
execute_process(
40-
COMMAND python
41-
${CMAKE_CURRENT_SOURCE_DIR}/cmake/blendluxcore_version.py
42-
${CMAKE_CURRENT_SOURCE_DIR}/blender_manifest.toml
43-
OUTPUT_VARIABLE BLC_VERSION
44-
)
42+
if (CMAKE_BUILD_TYPE STREQUAL "Latest")
43+
set(BLC_VERSION "Latest")
44+
else()
45+
execute_process(
46+
COMMAND python
47+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/blendluxcore_version.py
48+
${CMAKE_CURRENT_SOURCE_DIR}/blender_manifest.toml
49+
OUTPUT_VARIABLE BLC_VERSION
50+
)
51+
endif()
4552

4653
find_program(BLENDER blender NAMES blender.exe VALIDATOR validate_blender_version NO_CACHE REQUIRED)
4754

0 commit comments

Comments
 (0)