-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (54 loc) · 2.13 KB
/
push-on-main.yaml
File metadata and controls
65 lines (54 loc) · 2.13 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
name: Create TOX Release
on:
push:
branches:
- main
jobs:
Build_tox:
runs-on: [self-hosted, Windows, TouchDesigner]
steps:
- name: Check out repository code
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
submodules: true
- name: SudoMagic TD Package Builder
uses: SudoMagicCode/action-build-td-tox-package@v0.0.5
with:
build_settings: ./buildSettings.json
- name: Generate Hybrid Version
id: semver
run: |
# This pattern matches v, digits, a literal dot, and digits.
# It effectively blocks v1.0.1 because the * after the second number
# would usually allow another dot, but we want to anchor strictly.
$BASE_TAG = git describe --tags --abbrev=0 --match "v[0-9]*.[0-9]*" --exclude "v*.*.*" 2>$null
if ($LASTEXITCODE -ne 0) {
Write-Host "No base tag found, defaulting to v0.0"
$BASE_TAG = "v0.0"
}
# 2. Count commits since that base tag.
# If the current commit is the tag itself, COUNT will be 0.
if ($BASE_TAG -eq "v0.0") {
$COUNT = git rev-list --count HEAD
} else {
$COUNT = git rev-list --count "$($BASE_TAG)..HEAD"
}
# 3. Construct the hybrid VERSION (vX.Y.Z)
$VERSION = "$BASE_TAG.$COUNT"
Write-Host "Base Tag: $BASE_TAG"
Write-Host "Commits since base: $COUNT"
Write-Host "Final Release Version: $VERSION"
echo "VERSION=$VERSION" >> $env:GITHUB_OUTPUT
- name: Create Github Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.semver.outputs.VERSION }}
name: Release ${{ steps.semver.outputs.VERSION }}
# Generates "What's Changed" section automatically from PRs/commits
generate_release_notes: true
# Set to true if you want it to stay hidden until you review it
draft: false
prerelease: false
files: ./artifacts/package.zip