forked from LuxCoreRender/BlendLuxCore
-
Notifications
You must be signed in to change notification settings - Fork 1
135 lines (120 loc) · 4.58 KB
/
Copy pathrelease_bundle.yml
File metadata and controls
135 lines (120 loc) · 4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# SPDX-FileCopyrightText: 2024 Howetuft
#
#
# SPDX-License-Identifier: Apache-2.0
name: BlendLuxCore Create Release
on:
workflow_dispatch:
inputs:
release-version:
description: "Release version (major.minor.patch[-pre])"
required: True
default: ''
type: string
allow-updates:
description: "Update existing release (if any)"
required: True
type: boolean
default: False
jobs:
check-version:
name: 'Check version compliance'
runs-on: ubuntu-latest
steps:
- name: Checkout main repository
uses: actions/checkout@v6
- name: Check version compliance
if: ${{ inputs.release-version != '' }}
shell: python
run: |
import sys
import re
import tomllib
version = "${{ inputs.release-version }}"
# Check semver compliance
semver_regex = r"^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"
res = re.fullmatch(semver_regex, version)
if not res:
message = [
f"::error::INVALID RELEASE VERSION NUMBER '{version}' (SEMVER ERROR)",
"Version must comply to Semantic Versioning standard:",
"\n\tmajor.minor.patch[-pre]\n",
"See https://semver.org for more information",
"or leave the field blank for default value\n"
]
print("\n".join(message))
sys.exit(1)
# Check blender_manifest consistency
with open("blender_manifest.toml", "rb") as f:
manifest = tomllib.load(f)
manifest_version = manifest["version"]
if version != manifest_version:
message = [
f"::error::INVALID RELEASE VERSION NUMBER '{version}' (BLENDER MANIFEST ERROR)\n",
"Requested version is different from manifest version ",
"set in `blender_manifest.toml` file ",
f"('{manifest_version}')\n",
]
print("".join(message))
sys.exit(1)
# Success
print(f"::notice::Version number OK ('{version}')")
call-build-bundle:
name: 'Build BlendLuxCore Bundle'
needs: [check-version]
uses: ./.github/workflows/build_bundle.yml
with:
build_type: Release
create-release:
name: 'Create release'
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
needs: [call-build-bundle]
permissions:
id-token: write
attestations: write
contents: write
steps:
- run: |
_version=${{ inputs.release-version }}
echo "Creating release '${_version}'"
echo "RELEASE_TAG=v${_version}" >> "$GITHUB_ENV"
- uses: actions/checkout@v6
- run: mkdir ${{ github.workspace }}/dist
- uses: actions/download-artifact@v7
with:
path: ${{ github.workspace }}/dist
merge-multiple: false
- name: Display structure of downloaded files
run: ls -Rl ${{ github.workspace }}/dist
#- name: Re-zip artifacts
#working-directory: ${{ github.workspace }}/dist
#run: |
#mkdir ../artifacts
#for d in */ ; do
#d2=${d%/}
#echo "zip ${d2}"
#zip -j ../artifacts/${d2}.zip ${d2}/*
#done
- id: make-release
# Use full length commit SHA, otherwise CodeQL complains...
uses: ncipollo/release-action@cdcc88a9acf3ca41c16c37bb7d21b9ad48560d87
with:
name: "BlendLuxCore ${{ env.RELEASE_TAG }}"
tag: ${{ env.RELEASE_TAG }}
artifacts: ${{ github.workspace }}/dist/*
removeArtifacts: true
allowUpdates: ${{ inputs.allow-updates }}
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
updateOnlyUnreleased: true
body: |
## BlendLuxCore
This release was built from the following point in LuxCoreRender/BlendLuxCore:
- Branch: ${{ needs.call-build-bundle.outputs.branch }}
- Commit: ${{ needs.call-build-bundle.outputs.commit }}
Attestations:
${{ needs.call-build-bundle.outputs.attestation-url }}
- run: |
echo "### Release""" >> $GITHUB_STEP_SUMMARY
echo ${{ steps.make-release.outputs.html_url }} >> $GITHUB_STEP_SUMMARY