Skip to content

Commit 9b66f17

Browse files
committed
dev
1 parent 803e8c8 commit 9b66f17

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

.github/workflows/_version.yml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
on:
22
workflow_call:
3+
inputs:
4+
versionSpec:
5+
description: 'GitVersion binary version spec'
6+
type: string
7+
required: false
8+
default: '6.3.x'
9+
fetchDepth:
10+
description: 'Fetch-depth for checkout (0 for full history)'
11+
type: number
12+
required: false
13+
default: 0
14+
retentionDays:
15+
description: 'Artifact retention days'
16+
type: number
17+
required: false
18+
default: 1
319
outputs:
420
semVer:
521
description: 'GitVersion semantic version'
@@ -11,33 +27,33 @@ jobs:
1127
runs-on: ubuntu-latest
1228

1329
outputs:
14-
semVer: ${{ steps.gitversion.outputs.semVer }}
30+
semVer: ${{ steps.gitversion.outputs.SemVer }}
1531

1632
steps:
1733
- name: Checkout repository
1834
uses: actions/checkout@v4
1935
with:
20-
fetch-depth: 0
36+
fetch-depth: ${{ inputs.fetchDepth }}
2137

22-
- name: Setup GitVersion with specific binary version
23-
uses: gittools/actions/gitversion/setup@v4.1.0
38+
- name: Setup GitVersion
39+
uses: gittools/actions/gitversion/setup@v4
2440
with:
25-
versionSpec: '6.3.x'
41+
versionSpec: ${{ inputs.versionSpec }}
2642

2743
- name: Run GitVersion
2844
id: gitversion
29-
uses: gittools/actions/gitversion/execute@v4.1.0
45+
uses: gittools/actions/gitversion/execute@v4
3046

31-
- name: Discover project files
47+
- name: Write version artifact
3248
shell: bash
3349
run: |
3450
set -euo pipefail
35-
# Write main semantic version plus full JSON output for consumers
36-
printf '%s\n' "${{ toJson(steps.gitversion.outputs) }}" >> version.txt
51+
# Overwrite file (avoid appending) with JSON of outputs
52+
printf '%s\n' "${{ toJson(steps.gitversion.outputs) }}" > version.txt
3753
3854
- name: Upload version artifact
3955
uses: actions/upload-artifact@v4
4056
with:
4157
name: version
4258
path: version.txt
43-
retention-days: 1
59+
retention-days: ${{ inputs.retentionDays }}

0 commit comments

Comments
 (0)