-
Notifications
You must be signed in to change notification settings - Fork 19
82 lines (71 loc) · 2.88 KB
/
Copy pathBuildRelease.yml
File metadata and controls
82 lines (71 loc) · 2.88 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
name: Build Release
on:
push:
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: ${{ github.event.repository.name }}
- name: Check manifest version matches tag
id: manifest
run: |
python3 -c "
import os, sys, tomllib
with open('blender_manifest.toml', 'rb') as f:
m = tomllib.load(f)
tag_version = '${{ github.ref_name }}'.lstrip('v')
if tag_version != m['version']:
print(f'::error::Tag v{tag_version} != blender_manifest.toml version {m[\"version\"]}')
sys.exit(1)
with open(os.environ['GITHUB_OUTPUT'], 'a') as out:
out.write(f\"id={m['id']}\n\")
out.write(f\"version={m['version']}\n\")
"
working-directory: ${{ github.event.repository.name }}
- name: Cache Blender 4.2
id: cache-blender
uses: actions/cache@v4
with:
path: blender-download
key: blender-4.2-ubuntu-latest
- name: Download Blender 4.2
if: steps.cache-blender.outputs.cache-hit != 'true'
run: |
mkdir -p blender-download
pip install blender-downloader
blender-downloader 4.2 --extract --quiet --output-directory blender-download
- name: Locate Blender executable
id: blender
run: |
EXE=$(find blender-download -type f -iname blender | head -n 1)
if [ -z "$EXE" ]; then
echo "Could not find a Blender executable under blender-download/" >&2
exit 1
fi
chmod +x "$EXE"
echo "executable=$EXE" >> "$GITHUB_OUTPUT"
- name: Validate extension manifest
run: |
"${{ steps.blender.outputs.executable }}" --command extension validate ${{ github.event.repository.name }}
- name: Build extension zip
run: |
mkdir -p dist
"${{ steps.blender.outputs.executable }}" --command extension build --source-dir ${{ github.event.repository.name }} --output-dir dist
- name: Rename built zip
run: |
ZIP=$(find dist -maxdepth 1 -type f -iname "*.zip" | head -n 1)
mv "$ZIP" "dist/${{ steps.manifest.outputs.id }}_${{ steps.manifest.outputs.version }}.zip"
- name: Extract release notes from CHANGELOG.md
run: |
python3 ${{ github.event.repository.name }}/.github/scripts/extract_changelog_section.py \
--changelog ${{ github.event.repository.name }}/CHANGELOG.md \
--version "${{ github.ref_name }}" \
--product-name "Simple Renaming" \
--output release_notes.md
- name: Create GitHub release
run: gh release create "${{ github.ref_name }}" --notes-file release_notes.md dist/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}