Skip to content

Commit 7e4be2d

Browse files
author
tumbler
committed
Fix release workflow - upon pushing tag "release/v*.*.*", it will generate a release
1 parent f54d07e commit 7e4be2d

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

.github/workflows/release-main.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release
22
on:
33
push:
44
tags:
5-
- release/**
5+
- release/v*.*.*
66

77
jobs:
88
lint:
@@ -26,22 +26,18 @@ jobs:
2626
- uses: actions/checkout@v3
2727
with:
2828
fetch-depth: 0
29-
- name: Update version in __init__.py
30-
run: |
31-
# Extract version from tag (e.g., release/1.2.3 -> 1 2 3)
32-
version="${GITHUB_REF##*/}"
33-
major=$(echo $version | cut -d. -f1)
34-
minor=$(echo $version | cut -d. -f2)
35-
patch=$(echo $version | cut -d. -f3)
36-
sed -i "s/\"version\":\s*(.*)/\"version\": ($major, $minor, $patch),/" bms_blender_plugin/__init__.py
3729
- name: Build and zip folder
3830
run: |
39-
zip -r "bms_blender_plugin-${GITHUB_REF##*/}.zip" bms_blender_plugin/
31+
tag_version=$(echo "${GITHUB_REF#refs/tags/release/}")
32+
version_tuple=$(echo "$tag_version" | awk -F'[v.]' '{print $2", "$3", "$4}')
33+
sed -i "s/\"version\": .*/\"version\": (${version_tuple}),/" bms_blender_plugin/__init__.py
34+
zip -r "bms_blender_plugin-${tag_version}.zip" bms_blender_plugin
4035
echo "Zip file built"
36+
echo "TAG_VERSION=$tag_version" >> $GITHUB_ENV
4137
- name: Release
4238
uses: softprops/action-gh-release@v1
4339
with:
44-
tag_name: ${{ github.ref }}
45-
name: "Release ${{ github.ref }}"
40+
tag_name: "release/${{ env.TAG_VERSION }}"
41+
name: "${{ env.TAG_VERSION }}"
4642
files: |
4743
bms_blender_plugin*.zip

0 commit comments

Comments
 (0)