pull/254/head
Joe Marshall 2024-01-12 11:22:53 +00:00
commit 7dcf78706a
3 zmienionych plików z 35 dodań i 13 usunięć

Wyświetl plik

@ -1,4 +1,4 @@
name: Run tests on push / PR name: Make new release
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
@ -15,6 +15,8 @@ on:
jobs: jobs:
release: release:
runs-on: "ubuntu-latest" runs-on: "ubuntu-latest"
permissions:
contents: write
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.1
@ -28,34 +30,54 @@ jobs:
import os import os
v_file=Path("scripts","addons","cam","version.py") v_file=Path("scripts","addons","cam","version.py")
version_txt=v_file.read_text() version_txt=v_file.read_text()
major,minor,patch = re.match(version_txt,".*\((\d+),(\d+),(\d+)\)".groups() major,minor,patch = re.match(r".*\(\s*(\d+),(\s*\d+),(\s*\d+)\)",version_txt).groups()
major=int(major)
minor=int(minor)
patch=int(patch)
bump = os.getenv("VERSION_BUMP") bump = os.getenv("VERSION_BUMP")
if bump == "minor": if bump == "minor":
minor+=1 minor+=1
bump = "${{ inputs.logLevel }}" if bump=='patch':
if version=='patch':
patch+=1 patch+=1
elif version=='minor': elif bump=='minor':
minor+=1 minor+=1
patch=0 patch=0
elif version=='major': elif bump=='major':
major+=1 major+=1
minor=0 minor=0
patch=0 patch=0
v_file.write_text(f"__version__={(major,minor,patch)}") v_file.write_text(f"__version__=({major},{minor},{patch})")
# update in bl_info structure (which can't be dynamic because blender...)
init_file=Path("scripts","addons","cam","__init__.py")
init_text=init_file.read_text()
version_regex= r"\"version\"\s*:\s*\(([\d\s,]+)\)"
init_text = re.sub(version_regex,f'"version":({major},{minor},{patch})',init_text)
init_file.write_text(init_text)
env_file = Path(os.getenv('GITHUB_ENV')) env_file = Path(os.getenv('GITHUB_ENV'))
env_file.write_text("VERSION_TAG")=f"v{major}.{minor}.{patch}" env_file.write_text(f"VERSION_TAG={major}.{minor}.{patch}")
print(f"New version: v{major}.{minor}.{patch}") print(f"New version: {major}.{minor}.{patch}")
- name: Make addon zip - name: Make addon zip
uses: thedoctor0/zip-release@0.7.5 uses: thedoctor0/zip-release@0.7.5
with: with:
type: 'zip' type: 'zip'
filename: 'blendercam.zip' filename: 'blendercam.zip'
directory: './scripts/addons' directory: './scripts/addons'
- name: tag release - name: Write version number
if: ${{ inputs.version_bump }} != "overwrite previous tag"
run: |
git config --global user.name 'Release robot'
git config --global user.email 'release-robot@users.noreply.github.com'
git commit -am "Version number"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: make release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
with: with:
artifacts: "scripts/addons/blendercam.zip" artifacts: "scripts/addons/blendercam.zip"
tag: ${{ env.VERSION_TAG }} tag: ${{ env.VERSION_TAG }}
commit: ${ GITHUB_SHA } allowUpdates: true

Wyświetl plik

@ -57,7 +57,7 @@ from cam.version import __version__
bl_info = { bl_info = {
"name": "CAM - gcode generation tools", "name": "CAM - gcode generation tools",
"author": "Vilem Novak", "author": "Vilem Novak",
"version": (0, 6, 9), "version":(0,9,7),
"blender": (3, 6, 0), "blender": (3, 6, 0),
"location": "Properties > render", "location": "Properties > render",
"description": "Generate machining paths for CNC", "description": "Generate machining paths for CNC",

Wyświetl plik

@ -1 +1 @@
__version__=(0,9,3) __version__=(0,9,7)